admin管理员组文章数量:1130349
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?
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?
Share Improve this question edited Feb 17, 2015 at 9:18 Mostafa Ghanbari asked Feb 16, 2015 at 20:42 Mostafa GhanbariMostafa Ghanbari 4541 gold badge5 silver badges16 bronze badges 9- 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 Commented Feb 16, 2015 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 Commented Feb 16, 2015 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/plugins/pods – Mostafa Ghanbari Commented Feb 17, 2015 at 5:21
- 1 you could use PODs plugin to store data in custom table pods.io/tutorials/how-tos-sceencasts-series/… – PayteR Commented Dec 21, 2017 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 Commented Jan 4, 2018 at 23:39
1 Answer
Reset to default 2So 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.
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?
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?
Share Improve this question edited Feb 17, 2015 at 9:18 Mostafa Ghanbari asked Feb 16, 2015 at 20:42 Mostafa GhanbariMostafa Ghanbari 4541 gold badge5 silver badges16 bronze badges 9- 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 Commented Feb 16, 2015 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 Commented Feb 16, 2015 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/plugins/pods – Mostafa Ghanbari Commented Feb 17, 2015 at 5:21
- 1 you could use PODs plugin to store data in custom table pods.io/tutorials/how-tos-sceencasts-series/… – PayteR Commented Dec 21, 2017 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 Commented Jan 4, 2018 at 23:39
1 Answer
Reset to default 2So 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.
本文标签: Separate Database Tables For Different Post Types
版权声明:本文标题:Separate Database Tables For Different Post Types 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749256447a2340557.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论