2

Consider a busy site with about 10,000 posts divided in 10 custom post types. Custom taxonomies and custom fields are also used on all of them.

The main query was modified to include all these posts types everywhere, on index, archives, search, feeds.

Now, is there any performance hit caused by using custom post types versus regular 'post'? Or it wouldn't make a difference what types they are?

1
  • without knowing the specifics (at least the code you use) and the distribution of the posts between the post types, it is hard to estimate the impact. Commented Mar 8, 2018 at 6:06

4 Answers 4

2

No. All posts are stored in the wp_posts table. The post type is defined by post_type column.

Regardless to custom post types included in query, there is only one SQL query executed. Of course there may be some performance hit caused by a little bit more complex query (in vs. =), but it's marginal.

3

No, there is no meaningful performance difference.

  • They're all stored the same way internally
  • They're all queried the same way

Every query is a post type query, if you don't specify which ones, it'll use post, the built in post types have no special performance advantage over custom post types, and the post type column is indexed for performance

1
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – Howdy_McGee
    Commented Mar 9, 2018 at 17:15
2

There is no difference, the CPT is stored in the same wp_posts table as "normal" posts - as mentioned by most answers here - however, I would also add that where performance can be impacted is if you store a lot of postmeta (custom fields) so - for best performance - try not to store "lots" in postmeta - so use custom taxonomies where at all possible!

1
  • I learned that the hard way, using custom taxonomies whenever the data isn't post specific. Commented Mar 19, 2018 at 22:06
0

I've handled sites with 400,000 - 500,000 posts and they work fine .. 10,000 posts is nothing for WordPress to handle regardless of the usage of custom taxonomies & custom fields.

WordPress has a very mature architecture to handle post meta data and the built-in functions and procedures are quite good enough to handle loads of data.

The first thing you need to know that WordPress stores page, post & <custom-post-types> alike, they're stored in wp_post table and the post_type fields differentiates them; the meta data is stored in wp_postmeta table each custom field is identified by meta_key and linked to the post by post_id field!

The only performance issue is the way you retrieve them, optimizing your custom query to the max is the solution to your performance issues!

Your Answer

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

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