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

  • SEARCH
  • Home
  • 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 3345464
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:11:21+00:00 2026-05-18T01:11:21+00:00

EXPLAIN EXTENDED SELECT id, name FROM member INNER JOIN group_assoc ON ( member.id =

  • 0
EXPLAIN EXTENDED SELECT id, name
FROM member
INNER JOIN group_assoc ON ( member.id = group_assoc.member_id
AND group_assoc.group_id =2 ) 
ORDER BY registered DESC 
LIMIT 0 , 1

Outputs:

id  select_type table   type    possible_keys   key key_len ref rows    filtered    Extra
1   SIMPLE  group_assoc ref member_id,group_id  group_id    4   const   3   100.00  Using temporary; Using filesort
1   SIMPLE  member  eq_ref  PRIMARY PRIMARY 4   source_member.group_assoc.member_id 1   100.00   

explain extended SELECT
                        id, name
                    FROM member WHERE
                        id
                    NOT IN (
                        SELECT
                            member_id
                        FROM group_assoc WHERE group_id = 2 
                    )               
                    ORDER BY registered DESC LIMIT 0,1

Outputs:

id  select_type table   type    possible_keys   key key_len ref rows    filtered    Extra
1   PRIMARY member  ALL NULL    NULL    NULL    NULL    2635    100.00  Using where; Using filesort
2   DEPENDENT SUBQUERY  group_assoc index_subquery  member_id,group_id  member_id   8   func,const  1   100.00  Using index; Using where

The first query I’m not so sure about, it uses a temporary table which seems like a worse idea. But I also see that it uses fewer rows than the 2nd query….

  • 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-18T01:11:21+00:00Added an answer on May 18, 2026 at 1:11 am

    These queries return completely different resultsets: the first one returns members of group 2, the second one returns everybody who is not a member of group 2.

    If you meant this:

    SELECT  id, name
    FROM    member
    LEFT JOIN
            group_assoc
    ON      member.id = group_assoc.member_id
            AND group_assoc.group_id = 2
    WHERE   group_assoc.member_id IS NULL
    ORDER BY
            registered DESC 
    LIMIT 0, 1
    

    , then the plans should be identical.

    You may find this article interesting:

    • NOT IN vs. NOT EXISTS vs. LEFT JOIN / IS NULL: MySQL

    Create an index on member.registered to get rid of both filesort and temporary.

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

Sidebar

Related Questions

EXPLAIN SELECT * FROM ( `phppos_items` ) WHERE ( name LIKE 'AB10LA2%' OR item_number
The following explain extended let me know that MySQL is internally doing a lot
I'd appreciate it if someone could explain the concept of extended rendezvous to me.
I have a very simple query: SELECT cp.`id_connections` FROM `connections_page` cp WHERE cp.`time_end` IS
Explain why a nullable int can't be assigned the value of null e.g int?
Please explain to me why the very last echo statement is blank? I expect
Let me try to explain what I need. I have a server that is
Can someone explain the mechanics of a jump table and why is would be
Could anybody explain in plain words how Cloud computing works? I have read the
Let me explain: this is path to this folder: > www.my_site.com/images And images are

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.