MySQL Forums
Forum List  »  Optimizer & Parser

Expland and slow-query don't agree
Posted by: Aram Mirzadeh
Date: August 03, 2014 06:24AM

Hi,

Odd question. In my slow log I'm seeing that a call to a SPROC is going through millions of rows and returning only a few.

EXPLAIN-ing the SPROC, which is a multi-table union sql to get a few data points. Every select (except 2) within the union is using the right index. The 2 that are not are 1) Select a count for division, which is derived into the outer Select and 2) the last union that puts all of the selects together.

It is a very long Union (12 selects + 1 inner select in all), am I better off selecting each piece into a variable and then selecting the variables?

Options: ReplyQuote


Subject
Views
Written By
Posted
Expland and slow-query don't agree
1968
August 03, 2014 06:24AM
1015
August 04, 2014 01:23PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.