[wp-hackers] Performance improvement -- '/%postname%/%post_id%/' over '/%postname%/'?
otto at ottodestruct.com
Sat Jan 11 20:36:46 UTC 2014
On Sat, Jan 11, 2014 at 1:54 PM, Nikola Nikolov <nikolov.tmw at gmail.com> wrote:
> What could possibly be faster though would be to create a custom post type
> with it's own custom rewrite rules(in the form of
> "/cpt/%cpt_name%/%post_id%/" - you would get slightly longer permalinks,
> but it might be worth it. You wouldn't have to pass the post name to the
> query, but just the ID. It will also require some extra code - to create
> the proper permalinks when they are requested for a post of that post type,
> to add in the rewrite rules, etc.
The post_name and the ID are both indexed fields in the database. The
performance difference for querying on one vs. the other is either
negligible or actually non-existent.
More information about the wp-hackers