Skip to content
david-binda edited this page Sep 23, 2014 · 6 revisions

First of all, the plugin drops index over post_date on activation

CREATE INDEX post_date ON {$wpdb->posts} (post_date);

Getting a next page on standard homepage post listing may look like the one below:

SELECT wp_posts.ID FROM wp_posts 
WHERE 1=1 AND wp_posts.ID NOT IN (1241) 
AND wp_posts.post_type = 'post' 
AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') 
AND wp_posts.post_date <= '2009-08-06 09:39:56' 
AND NOT( wp_posts.post_date = '2009-08-06 09:39:56' AND wp_posts.ID >= 1170 ) 
ORDER BY wp_posts.post_date DESC, wp_posts.ID DESC 
LIMIT 10

For getting back to previous one the framework produces something like this:

SELECT * FROM
(SELECT wp_posts.* FROM wp_posts WHERE 1=1 
AND wp_posts.ID NOT IN (1241) 
AND wp_posts.post_type = 'post' 
AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') 
AND wp_posts.post_date >= '2009-07-02 02:00:03' 
AND NOT( wp_posts.post_date = '2009-07-02 02:00:03' AND wp_posts.ID <= 1152 ) 
ORDER BY wp_posts.post_date ASC, wp_posts.ID ASC 
LIMIT 10) as results 
ORDER BY results.post_date DESC, results.ID DESC
Clone this wiki locally