WordPress.org

Ready to get started?Download WordPress

Forums

Too many static pages crashing database? (31 posts)

  1. Stroheim
    Member
    Posted 7 years ago #

    Ok, so I have approximately 1300 static pages that I created outside of my normal posts. I created each page separately for a high resolution photograph that was linked to from my post. For example, my original post would have ten thumbnails and clicking each thumbnail would take you to one of these static pages which shows the photograph.

    I'm having a problem now though. Whenever I create a new static page with a photo, it is published but it also brings my entire blog down and I can't access certain parts of the dashboard like posts and pages. I get fatal error messages like maximum time exceeded etc.

    The only way I can fix this is to go into the database and randomly delete some past static pages. That is the only way for me to get everything working again.

    So my question is: did I hit a limit of how many static pages I can have or is my database simply corrupted?

    And if I did reach a limit on pages, is there another way to deal with publishing these photographs outside of the posts.

    Any help is greatly appreciated. Thanks for the time.

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Too many static pages will not crash anything, since a page is just a post with a different type. However, you may run into time-out problems and your blog will certainly be a lot slower.

    There are many plugins to do photo publishing with wordpress, I would suggest looking into one of those.

  3. Stroheim
    Member
    Posted 7 years ago #

    Thanks for the response, Otto.

    I just automatically assumed that the pages were the problem because everything would go down upon the creation of a page, but never a post.

    I am certainly running into time-out problems and have messed around with increasing the time limits but that hasn't helped either.

    I'll look into the plugins and see what I can find to do the job there.

    Thanks again.

  4. skydrak
    Member
    Posted 7 years ago #

    Same here... Look @ http://wordpress.org/support/topic/99927?replies=1 . I fount out that the problem is updating the permalinks...

  5. Stroheim
    Member
    Posted 7 years ago #

    Yes, it appears we are having the exact same problem. I thought it might be the permalinks also. Looks like I should do some searching on that problem as well.

  6. skydrak
    Member
    Posted 7 years ago #

    Have searched for a solution over months... But I found nothing :(

  7. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    What do you mean by "updating the permalinks"? There's no update to be done. It's not like permalinks are stored somewhere. They're done on the fly, they are not "stored".

    If you have large numbers of static pages, then the process that figures out permalinks can slow down the blog to the point of unusability. This is not a bug, it just doesn't scale to many thousands of pages without having a bigger and badder system for your database. You could probably add some indexes to remedy the speed issues, it's not entirely optimal in that respect.

    But there's no "updating" of permalinks. Ever. Not in WordPress 2.0 and up.

  8. skydrak
    Member
    Posted 7 years ago #

    The permalinks are stored in the database and they are updated by publishing a new page every time.

  9. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    The permalinks are stored in the database and they are updated by publishing a new page every time.

    No, actually, they're not. That's not how permalinks work at all.

  10. YellowSwordfish
    Member
    Posted 7 years ago #

    The rewrite-rules for all pages are stored in one row of the options able. And it gets amazingly big amazingly fast...

  11. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    The rewrite-rules for all pages are stored in one row of the options able. And it gets amazingly big amazingly fast...

    Ahh, I see it now. That's for pages and attachments only though, which is what confused me.

    Okay, that means that it'll run out of page space when the row exceeds maximum row size. In an MyISAM table, that's 65534 bytes. Since it's the page names that are the determining factor, I'd estimate that you're looking at between 800-1500 pages, maximum, depending on page name length.

    This is a rather dumb way to do it, BTW. It should just select post_name from wp_posts where post_status = 'static' instead, to get the allowable page name. Storing them in a single row in options is silly. Hierarchy does make it trickier, but not too much so, I think.

  12. YellowSwordfish
    Member
    Posted 7 years ago #

    I have been trying to find the email thread I had with Mark Jaquith on this just a couple of weeks ago in which he kindly explained to me what and how the table row is used but sadly seem to have deleted it.

    It is a single row in the Options table with a key of 'rewrite-rules'. I only have 35 or so 'pages' in my posts table but this row is over a MB in size so I should imagine someone with hundreds of pages is going to suffer problems.

    In my case (and I suspect most cases) the row only seemed to appear after I updated my permalink structure, at least that is when I first noticed it.

    I would politely suggest that before you just reply and tell me there is no such thing, you do some fact checking.

  13. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Well, like I said above, there should not be any such thing. It's silly. And it appears to only be for Pages and not Posts and the rest, which confused me. Permalinks for other things don't store the URIs in the database, so having just pages do it is highly strange.

  14. YellowSwordfish
    Member
    Posted 7 years ago #

    Ah - you changed your post! That's cheating.
    So - how do we get rid of it if it's not needed?

  15. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    The only way I can see to get rid of it would be to rework WP_Rewrite->page_rewrite_rules(). How exactly it would have to be reworked, I'm uncertain. I need to study WP_Rewrite in more detail.

  16. kineda
    Member
    Posted 7 years ago #

    Otto42 - any luck reworking WP_Rewrite? It was pretty hard digging up this post, so I started by own thread about the same problem:
    http://wordpress.org/support/topic/100900?replies=3

    Mods - I'd like to keep everything in this thread if possible to help folks with the same problem.

  17. kineda
    Member
    Posted 7 years ago #

    Looks like there might be a solution afterall. Any of you guys want to give this a shot?

    http://comox.textdrive.com/pipermail/wp-hackers/2006-August/008040.html

    Look for the function named generate_page_rewrite_rules() in the
    wp-includes/functions-post.php file.

    Within that function, look for this line:

    update_option('page_uris', $page_rewrite_rules);

    Right before that line, add this line:

    delete_option('page_uris');

    It should then look like this:

    delete_option('page_uris');
    update_option('page_uris', $page_rewrite_rules);

  18. kineda
    Member
    Posted 7 years ago #

    I gave this a try myself, and unfortunately it didn't solve the issue of slow saving and editing of pages.

  19. Mark Jaquith
    WordPress Lead Dev
    Posted 7 years ago #

    Definitely looks like a scaling issue. I've opened up a ticket with a 2.2 milestone.

  20. kineda
    Member
    Posted 7 years ago #

    Ryan wrote: [4773] should help. I thought I checked this in long ago, but evidently I forgot to. Went ahead and put it in 2.1.

    Apparently, 2.1 doesn't fix the issue either. :(

  21. RageX
    Member
    Posted 7 years ago #

    can someone make a Big Resume here? The guy is talking about Page and over a Thousand of Them for Pictures...
    About The Thumbnail in Post and Link to static page why u don't do something like...
    Make a New Post.
    Put Thumbnails in it.
    Then add in code section <!--nextpage--> Put the first Thumbnails Full Size Picture. again Next Page in code Put 2nd Image and so on... then all you would have to do is link Thumbnail to yourpostname/numberOfThePage/ (number of the page is every time u do nextpage.

    Anyway to be sure il go test this.

  22. kineda
    Member
    Posted 7 years ago #

    Unfortunately, that's a work around to being able to have many Pages in wordpress.

    This is still an issue that needs to be resolved.

  23. kineda
    Member
    Posted 7 years ago #

    Any updates on a fix?

  24. kicksonfire
    Member
    Posted 6 years ago #

    I am having the same problems.... still awaiting a solution... No luck yet.. Everyone try to get in touch with the developers please....

  25. Bobcat
    Member
    Posted 6 years ago #

    There's a patch for 2.3 here http://trac.wordpress.org/ticket/3614
    Backup everything first and use at your own risk!

  26. oledole
    Member
    Posted 6 years ago #

    Thanks Bobcat. That almost did it (loads nice and fast), exept now some pages don't show up in Manage->pages, e.g. no subpages below level 3, and almost no pages with two-digit pageID. Any ideas way?

  27. oledole
    Member
    Posted 6 years ago #

    Regarding the patch: I'm using the page category organiser-plugin, and it opens its "manage pages -page"without problems. It looks as if it's using a similar function as the patch above to get the pages to list, so that might be a way to proceed ...?

  28. Dalton
    Member
    Posted 6 years ago #

    I mentioned this over on Trac, too, but for anybody interesting in installing this patch...

    I was having site freezing issues b/c of too many pages as well. I looked at my database, and my re-write rules were a mile long. I installed the patch and everything looked OK. A weird side effect, though - children pages off my main blog page are not accessible anymore. I can view them in the manager, and even make edits to them, but trying to view them or access the URL directly generates a 404.

    I have WordPress installed in a subfolder, so most of my pages are actually peers of the blog page and not sub-pages. All of my other pages work just fine, it's just the sub-pages of the blog that are affected.

    I really hope this problem is addressed in a more comprehensive way for 2.4.

  29. Dalton
    Member
    Posted 6 years ago #

    An update on my previous post - the 404 errors were caused because I'm using a /%postname% permalink structure. Changing it to /%year%/%postname% did the trick.

  30. tmuka
    Member
    Posted 6 years ago #

    After reading all the trac progress i'm both excited for the progress, and dissapointed that /%postname% permalink structure won't be optimized for speed. I'm using wordpress in a CMS context and having pages named like /2006/contact/ doesnt make much sense... anyone have a better alternative that will still help with speed?

Topic Closed

This topic has been closed to new replies.

About this Topic