Re: Help me to optimize my sql query
Posted by:
Rick James
Date: August 22, 2014 06:50AM
To assist in analyzing slow SELECTs, please provide
* SHOW CREATE TABLE tbl\G -- engine, indexes
* SHOW TABLE STATUS LIKE 'tbl'\G -- sizes
* EXPLAIN SELECT ...\G -- clues of inefficiencies
* SHOW VARIABLES LIKE '%buffer%'; -- cache size
and surround them with [ code ] and [ / code ]
Without knowing what the indexes are, I can't say what is happening.
However, filtering on one table, then ordering on another necessarily requires collecting stuff from both tables before being able to optimize much.
Mixing DISTINCT and GROUP BY is usually a mistake. What is the purpose of each?
Do you need "LEFT" JOIN? Will the 'right' table be missing rows? If not, use "JOIN".
Subject
Views
Written By
Posted
2406
August 21, 2014 07:29AM
Re: Help me to optimize my sql query
1188
August 22, 2014 06:50AM
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.