How much worse is querying custom fields compared to custom taxonomies, quantitatively

OK, I know (because i’ve read it many times) why custom fields is less efficient than custom taxonomies when it comes to querying/filtering posts, but just how inefficient is it by comparison? I’d love some researched quantitative statistics to back this up.

What sort of number of posts and custom fields are we talking about before my website collapses?

Answer

The trouble with meta queries is they require an additional join per filter. Say you have a property site, and you’re searching by location, rooms and price. That’s three joins. If you were using taxonomies, just two (terms and term_taxonomy) – no matter how many filters.

The other reason taxonomies tend to beat meta queries is their db schema. They’re well indexed and optimised for searching – the meta table, whilst indexed on meta keys, has a value field that’s large text – start querying on that bad boy (especially LIKE statements) and MySQL will have to take a breath or two.

Having said all that, meta queries have their place and can be extremely useful (with caution). And to be honest, unless you’ve got thousands of posts, or you’re applying several meta queries, the difference will probably be negligible.

Attribution
Source : Link , Question Author : Pete , Answer Author : TheDeadMedic

Leave a Comment