Anunay Arunav
Anunay Arunav

Reputation: 89

Using Index;Using Temporary, will it slow down the order?

I have an sql query, which is complex and hard to debug, as I have generated it through my own written querybuilder class. But its all working(its just that variable names are not user friendly). Now when I run the explain, it gives me the following output on first row:

id  select_type table   type    possible_keys   key key_len ref rows    Extra
1   PRIMARY         user1_  const   PRIMARY         PRIMARY 257 const   1   Using index; Using temporary

Now I want to know, if it's a problem (performance problem), when I have a large user base of about 100k. Please tell me if I need to provide database schema or query (its an 8k characters long query).

Upvotes: 0

Views: 56

Answers (1)

tadman
tadman

Reputation: 211610

Any time you see "Using temporary" you're in for a world of hurt. This involves creating a temporary file and reading it back in later. Do everything you can to avoid this, especially for larger result sets, but sometimes you just need to pay the price since there's no other way.

Keep in mind this might take a query that should execute in 1ms take 5ms, not an especially severe delay, but if it normally takes 10 seconds and instead takes 50 you will start to feel the pain.

Upvotes: 1

Related Questions