• Hi,

    Does anyone know which of these is quicker to query and why, custom post types or custom taxonomies?

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Can you give some specific examples of the queries you want to run? If it is just for displaying content at specific URLs, the biggest thing you can do is cache the output of the page so that the DB doesn’t even get queried for the most part.

    Thread Starter starzwah

    (@starzwah)

    Hi nickohrn,

    Thanks for replying.

    I take your point about caching on board although specific urls will not always be known.

    For searching posts with specific keywords, is it more efficient to search through post types of taxonomy?

    Examples:
    Apologies if syntax is incorrect.
    1)
    customPosttype=fruit&keywords=green
    OR
    customTaxonomy=fruit&keywords=green
    Which would be more efficient?

    2)
    customPosttype=fruit&custonTaxonomy1=green&custonTaxonomy2=new
    OR
    customTaxonomy1=fruit&customTaxonomy2=green&customTaxonomy3=new
    Which would be more efficient?

    3)
    customPosttype=fruit&custonTaxonomy1=green&custonTaxonomy2=new&keywords=ipsum
    OR
    customTaxonomy1=fruit&customTaxonomy2=green&customTaxonomy3=new&keywords=ipsum
    Which would be more efficient?

    Thanks

    Thread Starter starzwah

    (@starzwah)

    Also, in Example 1, I’m assuming that…
    “customPosttype=fruit&keywords=green” would just query the posts table
    While
    “customTaxonomy=fruit&keywords=green” would require JOIN’s within the query, making it slower.

    Would that be correct to your knowledge?

    In general, when you perform a taxonomy query you’re going to be querying multiple tables whereas if you’re just querying a custom post type you’ll be querying the posts table by itself (probably).

    However, the taxonomy table is indexed well enough that performing queries on taxonomies isn’t a huge drag on efficiency. If you’re going to be doing search queries (which I’m assuming is the case because you’re sending keywords to the query function) that’s going to be your bottleneck because the content fields necessarily aren’t indexed.

    My advice to you is to build out what makes sense for your content structure, whether that is custom post types, custom taxonomies, or both, and profile from there. I think worrying about which query will take longer when the difference is likely to be negligible is the wrong road to go down.

    Thread Starter starzwah

    (@starzwah)

    Thanks, great advice

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom post types or custom taxonomies – performance’ is closed to new replies.