MySQL Forums
Forum List  »  Optimizer & Parser

Re: Query optimization
Posted by: Jan Kowalski
Date: May 17, 2013 03:52AM

I have another issue. For better overview, this is my table and indexes https://docs.google.com/file/d/0BzH_1T4FBZ5SbmI4cHZSaENhOHc/edit?usp=sharing
After adding this index (status_modifiedgmt) another query
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
FROM wp_posts
WHERE 1 =1
AND wp_posts.post_type = 'post'
AND (
wp_posts.post_status = 'publish'
)
ORDER BY wp_posts.post_date DESC
LIMIT 0 , 9
which is supposed to use type_status_date index, stops using it and starts using status_modifiedgmt, which makes it do filesort.
How can I force this query to use type_status_date index. I don't have acces put FORCE INDEX in php code.



Edited 1 time(s). Last edit at 05/17/2013 03:53AM by Jan Kowalski.

Options: ReplyQuote


Subject
Views
Written By
Posted
2823
May 10, 2013 05:35AM
1360
May 12, 2013 08:42PM
1317
May 15, 2013 06:45AM
1340
May 15, 2013 08:35AM
1453
May 16, 2013 08:18AM
Re: Query optimization
1390
May 17, 2013 03:52AM
1319
May 17, 2013 11:47PM
1230
May 21, 2013 08:51AM
1388
May 22, 2013 08:08AM


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.