HARD NOTE: This question is solely about performance, and NOT search engine optimization. So, please make sure your answers are as such.
W.r.t permalinks, “year” is the most obvious numeric of choice, and nothing can be more specific to a post than a post ID (also a numeric).
Otto has for so long been suggesting the use of a permalink structure that “starts with something easily identifiable, like a number.”
=> something like this (since he said at the “start”):
But from a discussion in WP.SE chat, I’ve learnt that the WP_Query system parses its request (a post permalink information) “from right to left.”
=> something like this should perform better:
(where, 121 is the post ID)
QUESTION: To me, points (1) and (2) are contradictory. Which one is true? Am I missing something here?
I sure do know that some fixes in WordPress 3.3.X have shown “huge performance gains” for permalink structures independent of a numeric, BUT that does not necessarily mean, there’s NO performance loss (even the slightest). So IMO, this question is not completely irrelevant.
Answer: as of 3.3 and beyond, a “problem” structure now only adds one single optimized query. I wrote a post about that, in fact.
Bottom line: it’s no longer an issue. You’re welcome. 😉
Both points (1) and (2) are actually right and not at all contradictory.
The WordPress Codex once said:
For performance reasons, it is not a good idea to start your permalink
structure with the category, tag, author, or postname fields. The
reason is that these are text fields, and using them at the beginning
of your permalink structure it takes more time for WordPress to
distinguish your Post URLs from Page URLs (which always use the text
“page slug” as the URL), and to compensate, WordPress stores a lot of
extra information in its database (so much that sites with lots of
Pages have experienced difficulties). So, it is best to start your
permalink structure with a numeric field, such as the year or post ID.
+1 as a numeric at the beginning of your permalink structure allows WordPress to quickly distinguish between “posts” and “pages”.
WP_Query system parses its request (analysing a post’s permalink information) “from right to left.” So, the quicker it identifies and associates a permalink with a post, the quicker it shows up the post.
+1 as the post is retrieved quickly if you use a post ID at the end of the permalink.
As should be clear by now, points (1) and (2) deal with two different performance issues.
So, if my analysis is correct, at least theoretically, the best performing permalink formats should be (best at the top):
obviously, the default permalink structure
Next best is (most probably)
/%year%/%postname%/%post_id%/ which means, your post’s permalink looks similar to this:
Next best (especially when you have very few “Pages”) is
/%postname%/%post_id%/ which means, your post’s permalink looks similar to this:
Last fine choice would be
/%year%/%postname%/ which means, your post’s permalink looks similar to this:
Permalink structures like
/%year%/%monthnum%/%day%/%postname%/ only make sense when your website/blog’s posts are time dependent; say for example, a news site. Just my humble opinion.
Oh, and I should say that you are going to see very very “negligible” performance improvements from (1) to at least (4) — so, you need not actually worry about the order. But since I do, I’ve ordered them 😉
UPDATE: This post on some other blog confirms the analysis.
Also, the improvements that came in WordPress 3.3.X only affect your blog’s performance if you are using text-based permalinks (i.e. no numerics in permalinks). If you already have a numeric or two in your permalinks, you are ALREADY GOOD! 🙂
/%year%/%postname%/ is my permalink structure of choice — short, precisely informative, and sweet.
And you know what, if it really matters, you can always simply change your permalink structure to
/%year%/%postname%/%post_id%/ — your links are still in tact!