Jump to content

[RC6]Query of View New Content creates a Temporary Table


RevengeFNF

Recommended Posts

View New Content is using a query that have a DISTINCT and because of that is a slow query.

It works the same way without the distinct, so i don't see a need for it.

# Query_time: 7.098046  Lock_time: 0.000042  Rows_sent: 74  Rows_examined: 16968
# Full_scan: No  Full_join: No  Tmp_table: Yes  Tmp_table_on_disk: No
# Filesort: No  Filesort_on_disk: No  Merge_passes: 0  Priority_queue: No
#
# explain: id    select_type    table    type    possible_keys    key    key_len    ref    rows    Extra
# explain: 1    SIMPLE    forums_topics    ref    forum_id,last_x_topics,starter_id,last_post,most_recent_post    forum_id    2    const    846    Using temporary
# explain: 1    SIMPLE    forums_posts    ref    topic_id    topic_id    4    admin_fnf_beta.forums_topics.tid    19    Using where; Distinct
#
SET timestamp=1426540421;
/*IPS\Node\_Model::contentPostedIn:371*/ SELECT DISTINCT forums_topics.tid FROM `x_utf_ibf_forums_topics` AS `forums_topics` LEFT JOIN `x_utf_ibf_forums_posts` AS `forums_posts` ON topic_id=tid WHERE forums_topics.forum_id=77 AND (forums_posts.author_id=257 OR forums_topics.starter_id=257);

 

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...

I still have this on 4.0.2, so nothing was done in this regard:

Captura%20de%20tela%202015-04-29%2013.27

 

Reading mysql slow query log from /var/log/mysq-slow.log
Count: 1  Time=104.26s (104s)  Lock=0.00s (0s)  Rows_sent=788.0 (788), Rows_examined=89148.0 (89148), admin_fastnews[admin_fastnews]@localhost
  #
  # explain: id select_type     table   type    possible_keys   key     key_len ref     rows    Extra
  # explain: N  SIMPLE  forums_topics   ref     forum_id,last_x_topics,starter_id,last_post,most_recent_post    forum_id        N       const   N       Using temporary
  # explain: N  SIMPLE  forums_posts    ref     topic_id,first_post     topic_id        N       admin_fnf_beta.forums_topics.tid        N       Using where; Distinct
  #
  use admin_fnf_beta;
  SET timestamp=N;
  /*IPS\Node\_Model::contentPostedIn:N*/ SELECT DISTINCT forums_topics.tid FROM `ibf_forums_topics` AS `forums_topics` LEFT JOIN `ibf_forums_posts` AS `forums_posts` ON topic_id=tid WHERE forums_topics.forum_id=N AND (forums_posts.author_id=N OR forums_topics.starter_id=N)

The next queries are fast because they are cached, until something changes.

Can someone tell where do i edit this query to remove the DISTINCT? I want to test without it to check if the problem is solved.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...