MySQL Forums
Forum List  »  Optimizer & Parser

How to optimize group by and where
Posted by: Eric Colson
Date: November 06, 2011 01:36AM

Hi everybody,

I try since several days to improve the speed of the following query:
SELECT id_magasin, id_produit, SUM(int_qte_vendue)
FROM dwh.etl_vente
WHERE int_date BETWEEN 1148 AND 1178
AND id_magasin IN (6, 2, 9, 5, 31)
GROUP BY 1, 2;

I run the optimizer and I can read in the extra column:
Using temporary
Using Filesort

I have add a unique index on the three columns:
alter table etl_vente ADD UNIQUE NDX_MAGASIN4 (int_date, id_magasin, id_produit);

However, the "using temporary, using filesort" result always appears when running the optimizer.

What is wrong? Can someone help me please?

Eric

Options: ReplyQuote


Subject
Views
Written By
Posted
How to optimize group by and where
2039
November 06, 2011 01:36AM


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.