Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3355722
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:25:45+00:00 2026-05-18T02:25:45+00:00

I have a query that according to my slow query log it’s a bit

  • 0

I have a query that according to my slow query log it’s a bit slow….

Query_time: 8.408943  Lock_time: 0.000119 Rows_sent: 1  Rows_examined: 2911766

BUT, when I run the query with EXPLAIN in front of it, I don’t get the same results…

id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY forum range PRIMARY PRIMARY 4 NULL 3 Using where; Using temporary; Using filesort
1 PRIMARY category ref PRIMARY,forum_id forum_id 4 source_forum.forum.id 2  
1 PRIMARY board ref PRIMARY,category_id category_id 4 source_forum.category.id 4 Using where
1 PRIMARY topic ref PRIMARY,board_id board_id 4 source_forum.board.id 58  
1 PRIMARY post ref PRIMARY,topic_id,trash topic_id 4 source_forum.topic.id 16 Using where
3 DEPENDENT SUBQUERY post index topic_id created 4 NULL 1 Using where
2 DEPENDENT SUBQUERY group_assoc ref board_id,group_id board_id 4 source_forum.board.id 4 Using where

The highest row count there being used is 56…

update

My query:

SELECT
   COUNT(id) AS num
FROM (
    SELECT topic.*,
      (SELECT created FROM post WHERE topic_id = topic.id ORDER BY created DESC LIMIT 1) AS lastpost
    FROM topic
    WHERE board_id = 6 AND
    NOT EXISTS( SELECT id FROM topic_read_assoc WHERE topic_id = topic.id AND member_id = 489 )            
    ) tab
WHERE last_post_time > 1288032259;

explain extended

id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 440 100.00 Using where
2 DERIVED topic ref board_id board_id 4   429 100.00 Using where
4 DEPENDENT SUBQUERY topic_read_assoc ref topic_id,member_id topic_id 4 source_forum.topic.id 6 100.00 Using where
3 DEPENDENT SUBQUERY post index topic_id created 4 NULL 1 1600.00 Using where

What does filtered mean?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T02:25:45+00:00Added an answer on May 18, 2026 at 2:25 am

    Can you post the query and the SHOW CREATE TABLE statements too?

    58 indeed is not high, but you are using temporary tables AND a filesort. And since all your types are ref and not eq_ref, you have to multiply those values: 3*2*4*58*16*1*4 = 89k rows joined (see the rows examined – some tables probably got scanned entirely – see the USING WHERE comment)

    Can you post an EXPLAIN EXTENDED and SHOW WARNINGS?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query that orders a table according to a particular field. The
I have the query below that fetches 500 records according to certain criteria. The
I have a query that is dynamically built after looking up a field list
I have a query that originally looks like this: select c.Id, c.Name, c.CountryCode, c.CustomerNumber,
I have a query that looks like this: public IList<Post> FetchLatestOrders(int pageIndex, int recordCount)
I have a query that I'm executing from a .NET application to a SQL
I have a query that is currently using a correlated subquery to return the
I have a query that has 7 inner joins (because a lot of the
I have a query that works on Postgresql 7.4 but not on Postgresql 8.3
I have a query that runs super fast when executed in the sql editor

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.