Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Does having a unique post_date speed or slow down huge db? WordPress

  • SOLVED

If I have hundreds of thousands of posts and say 20 posts a day, would each post having a unique post_date make things slower or faster on the db - I could have several posts have the same exact same post_date or would it be better to make the seconds all a little different or does it not change anything

Answers (2)

2015-03-26

Francisco Javier Carazo Gil answers:

Katie,

I think that is not important. The queries that uses post_date to do the search maybe can become faster, but the rest not.

If you want to make your database faster: increase your MySQL cache

Look at for these values in my.cnf file:
query_cache_type = 1
query_cache_limit = 1M
query_cache_size = 16M


Also, have a good cache in your server, a proxy-cache server it is the best, for example Varnish. It won't optimize database, but all the site would become faster.

2015-03-27

Andrea P answers:

the post date is the default ordering in wordpress, so when doing a query, if it founds exaclty the same timestamp, it will have to look at another parameter to order the post (I'm not sure which one it will look, probably the post ID or the title).
then if all the posts have the same timestamp, for each post it will have to do this additional step.

so if the query is very large, it could slow down a bit, but we're talking about very very small time.

in any case, we're talking about slowing down only pages where there is a large query (with default ordering by date). the general site and the database won't be slowed down at all, in my opinion.

what is really important in these cases of hundreds of thousands, is if those posts have many custom fields, or custom taxonomies, and if they are normal posts or a custom post_type. these things could impact the database in general, and slow down any kind of query, cause tables will be huge and data will be spread in multiple tables.
but in any case, I've read about people who haven't got any issue with that amount of posts, the only thing they had to be really careful on optimizing everything else in the site, like scripts and stylesheets, images, caching, etc..