[wp-hackers] Freezing $now to increase query cache benefit
John Joseph Bachir
jjb at ibiblio.org
Fri Jan 6 04:31:51 GMT 2006
On Thu, 5 Jan 2006, Mark Jaquith wrote:
> So, I wrote a plugin to do just that. It updates an option with the
> date/time of the most recent published post (updated on edit, save,
> publish).
>
> It made a HELL of a difference. The main post query, when grabbed from
> the query cache, now takes less than 1/100 of a second, as compared to
> 3-15 seconds before.
On Thu, 5 Jan 2006, 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?
This is certainly an interesting optimization strategy-- designing a
system/schema around the idea of changing the generated sql queries as
infrequently as possible in order to maximize cache hits. If the
future-post system was changed in core to have the behavior of Mark's
plugin, which would cut a big query out of every front page hit of a
WordPress blog, think of all the sql processing that would be saved all
around the world! :) Also, I wonder where else in wordpress we could do
something similar?
John
--
http://lyceum.ibiblio.org
More information about the wp-hackers
mailing list