8

one big problem with wordpress is that everything on it is a post(a record in wp-posts table)! images, posts, pages, products(for example in woocommerce), portfolios, Post Revisions... Almost everything exists as a record in wp-posts table and the main difference between them is that their "post type" field are different! so by passing time your wp-posts table getting bigger and bigger and you can't do a thing about it unless remove posts like "Revisions" to make the table a bit lighter! is there a way to put main posts like "pages", "posts" and "medias" into separate tables?

  • 2
    it's probably easier to do some MySQL tuning and query modification rather than trying to split tables. I've seen WordPress installs with millions of rows in the posts table that were running fine with a few tweaks. – Milo Feb 16 '15 at 21:21
  • Interesting question. You wrote: "i know i can make custom post types into another table" - How did you handle WP_Query queries with multiple post types, including the separated ones and the unique post ID's ? – birgire Feb 16 '15 at 21:22
  • @birgire actually i didnt do it yet but with some search on google seems that it is possible! take a look at Pod Framework: wordpress.org/plugins/pods – Mostafa Ghanbari Feb 17 '15 at 5:21
  • 1
    you could use PODs plugin to store data in custom table pods.io/tutorials/how-tos-sceencasts-series/… – PayteR Dec 21 '17 at 18:07
  • 2
    I'd recommend against using pods, for the sake of scaling and maintainability. But that's just my personal experience. – admcfajn Jan 4 '18 at 23:39
1

So the only reason you want to re-architect WordPress to use multiple tables for different post types is because your posts table is getting bigger too fast? I assume the underlying issue for you is that performance is suffering?

Instead, I suggest adding appropriate indexes to the post table for the queries you are finding unacceptably slow. This will be a whole lot easier and you won't have to have a nonstandard version of WP to deal with for everythi.g else you want to do.

Here's one reference to help with indexing.

| improve this answer | |
  • actually this is quite an interessting question. in my case not for performance reasons but instead because of handling. I have a hoster that has a staging mechanism … with all the content in this table user created content make it impossible to use this without deactivating areas that allows users to create content. With some CPTs in a separate table the staging merge would be alot easier – GDY Dec 10 '19 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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