14

I have read the discussion on the performance of different permalinks on the wp hackers mailinglist, THIS forum and around Google.

I could however not really deduce if the permalink structure I have been using for the past years is good or not:

/%postname%-%year%%monthnum%%day%.html

This combination put the postname directly after the / and the year,month,day combination makes it more unique since many postnames carry the same name. The html addition is something I have been using for the past 10 years on my blog (even pre wordpress) so that is legacy.

I dont know if this is good for permance or bad for performance, how can i check this?

(I have been running the blog for +10 years and there are about 10.000 posts with many links in)

links:

  1. http://codex.wordpress.org/Using_Permalinks

  2. http://www.google.com/search?q=wordpress+category+permalink+performance

  3. http://ottopress.com/2010/category-in-permalinks-considered-harmful/

  4. http://lists.automattic.com/pipermail/wp-hackers/2010-October/035458.html

3 Answers 3

8

You can check by looking at the size of the rewrite_rules option in the database. If it's small (which I believe it should with this structure), you're not using verbose rules. By contrast, if you see several lines per static page, you're using verbose rules and it's not good.

3
  • unfortunately... there are several lines per static page GRIN. So this is probably not a good permalink structure...hmmmm... this does explain an error message I got a while ago "WordPress database error Got a packet bigger than 'max_allowed_packet", I had to increase this setting in MySql.
    – edelwater
    Oct 29, 2010 at 14:56
  • then again... if you keep adding pages during years you will automatically get max_allowed_packet no matter what... unless you revert to non pretty permalinks... (i think) so... to be scalable for the next 30 years :) I will probably have to revert to non pretty permalinks. I think.
    – edelwater
    Oct 29, 2010 at 15:07
  • 1
    As long as you're using non verbose rules your page, attachment and custom post type rules are generic. So pretty links are quite safe in practice, so long as they're using a non verbose structure. Nov 11, 2010 at 23:48
1

I veto the accepted answer. The complexity of the rewrite rules is in no way a measure for the performance of article lookup.

In particular, it seems that starting your permalinks with post names is bad; see http://codex.wordpress.org/Using_Permalinks#Structure_Tags

Without having looked into Wordpress code, I can imagine that they somehow index posts hierarchically. Therefore, the variables used in permalinks should be ordered from left to right from the most general to the most post specific variable used. This heuristic strongly favors the standards year/month/name or category/name.

17
  • 1
    category/name is actually known and confirmed as causing performance issues if large amount of pages is present. It is not as much related to speed of lookup as to deducing correct object to serve and complexity of rewrite rules is completely relevant.
    – Rarst
    Nov 12, 2010 at 11:22
  • Can you give a doc/code reference please? I just skimmed the code (wp-include/rewrite.php and wp-include/query.php); while is looks really awful and unnecessarily complicated, it appears that basically the parts are collected and identified and then directly inserted into SQL queries. I still cannot see why this should take longer for different orders. But when the db-query is executed, several joins have to be performed and here order really matters. I seem to remember that MySQL is particularly bad at optimising join order.
    – Raphael
    Nov 12, 2010 at 18:53
  • I am not too deep into DB theory, but you have to keep products small. In any case, this might be a bug in the sense that it is programmed not as efficiently as it could be.
    – Raphael
    Nov 12, 2010 at 18:55
  • 2
    the Codex give "A few HINTS" (see Codex) and does not specificy the complete algorithm. It does however point to ottopress.com/2010/category-in-permalinks-considered-harmful and comox.textdrive.com/pipermail/wp-testers/2009-January/… all in all there is a sort of friction between best practices of url hacking in the field of human computer interaction and performance from the field of performance improvement.
    – edelwater
    Nov 14, 2010 at 17:26
  • 1
    Thanks for the pointer ottopress. It appaers that changing conventions such that every page url would start with /page/ and every post url with /post/, removing the unambiguity. You should be able to do this yourself, adding the fixed text to your permalink structure. This would probably be a good decision, anyways; what happens if I have a post BAR in category FOO and a page BAR that is subpage of FOO? Both would be addressed by /foo/bar/ assuming the %category%/%postname% scheme. Or are slugs globally unique?
    – Raphael
    Nov 14, 2010 at 19:09
0

Just for the workflow QA:

The answer is: NO this is not a good permalink structure concerning performance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.