[wp-hackers] Freezing $now to increase query cache benefit

Mark Jaquith mark.wordpress at txfx.net
Fri Jan 6 05:30:51 GMT 2006

The only thing that worries me about this is that plugins might be  
acting on future-published posts by looking for post_status =  
'draft' ... I can't name any off the top of my head, but it's a  
possibility.  Otherwise, post_status = 'future' would be great... we  
could just drop the post_date_gmt <= '$now' part altogether.  This  
would even make the first (non-cached) MySQL query faster!  AFAIK,  
that thing is a part of pretty much every post query, so a LOT more  
queries become cacheable when you do away with it.

On Jan 5, 2006, at 10:50 PM, David Chait wrote:

> There's a strong alternative: don't filter based on post date at  
> all, and
> move future-posts out of the 'normal flow'.  Future posts already  
> want to
> ping when they 'arrive', so the same cron/timing facility could  
> actually
> change a post state from, say, 'future' to 'publish' when the post  
> time
> passes.  That'd eliminate the extra query param entirely from the  
> 'average'
> query (I could see wanting to filter by date for other reasons...  
> but I
> think this'd all work nicely).  Thoughts?

Mark Jaquith

More information about the wp-hackers mailing list