[wp-hackers] lots of category items

Otto otto at ottodestruct.com
Thu Apr 5 22:30:50 UTC 2012


On Thu, Apr 5, 2012 at 5:10 PM, Haluk Karamete <halukkaramete at gmail.com> wrote:
> It was Otto's article (WordPress 3.1: Advanced Taxonomy Queries) that
> suggested me the otherwise.
>
> Cause it ends with this
>
>>Speed Concerns
>>Advanced taxonomy queries are cool, but be aware that complex queries are
> going to be slower. Not much slower, since the >code does attempt to do
> things smartly, but each taxonomy you add is the equivalent of adding a
> JOIN. While the relevant >tables are indexed, joins are still slower than
> non-joins.


In that article, you'll notice how I'm writing queries that depend on
multiple taxonomies, yeah? Well, each taxonomy you add means that the
query to get those posts has another JOIN. One taxonomy in the query =
one JOIN. Two taxonomies in the query = two JOINs. And so forth.

> However, I don't think that's the case. I think each taxonomy you create
> comes back at you as a join in the relavant query.

Each taxonomy *in your query* adds a join *to that query*. You can
have a million taxonomies, but if you're only querying against one of
them, then it's only one JOIN.

-Otto


More information about the wp-hackers mailing list