MySQL Forums
Forum List  »  Optimizer & Parser

Re: Why so great difference in so simple query ?
Posted by: Rick James
Date: August 23, 2009 06:57PM

please provide
* SHOW CREATE TABLE tbl\G -- easier to read than SHOW 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 ]

Perhaps the answer is that the first query simplifies:
`state` = (
-> SELECT
-> DISTINCT `loc`.`state_code`
-> FROM
-> `hp_location` as `loc`
-> WHERE
-> `loc`.`location_type` = "city"
-> AND `loc`.`state` = "New York"
-> );
boils down to simply state='New York' and there is an index in zipcodes on state.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Why so great difference in so simple query ?
2073
August 23, 2009 06:57PM


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.