Splitting posts+pages and attachments into separate tables

  1. David Torbert

    Right now, every post, page, or attachment is stored in the wp_posts table. This means that if you have 10,000 images and 50 posts+pages, every time you go to view a post or a page, it's querying a 10,000-row table instead of a 50-row table.

    The table could be partitioned into wp_posts and wp_attachments, then if a query needed to be run that really did require searching both, you would use a view instead.

    Written correctly, the schema could be written to allow other kinds of logical partitioning (eg, partitioning the tables by year).

    Posted: 6 years ago #
  2. Andy Macaulay-Brook


    Philosophically I think this is going the opposite way to WordPress. With custom post types, it sort of makes sense to bring more into the same table rather than split it. If you're in the unusual position of having so many images, and if you have a performance problem because of it, then maybe a plugin that uses its own db tables is the answer.

    Posted: 6 years ago #

RSS feed for this topic


You must log in to post.

  • Rating

    19 Votes
  • Status

    Sorry, not right now