Forums › Forums › Search & Filter Pro › Filtering by 'meta' vs 'taxonomy' – any difference in query speed/performance?
Tagged: best practices, performance, query speed
- This topic has 4 replies, 2 voices, and was last updated 5 years, 8 months ago by Anonymous.
-
Anonymous(Private) March 13, 2019 at 11:54 am #204995
Hi all – I’ve got a quick question.
I’m in the process of setting up a site and am trying to work out the best practices to future proof the site. The site will allow users to download files. I currently have it set up so that they can filter the files by software, version or required plugins, with those versions and plugins as custom taxonomies that I categorize each post against.
I of course also have the alternate option of setting those values as custom fields for each post. Using ACF, this would even allow me to set default values for new posts – which would be good for me as I will be allowing users to submit files to the site eventually and this would make submission/admin much easier.
Anyway, the question is: Does filtering by ‘meta’ vs filtering by ‘taxonomy’ using the S&F Pro plugin have any effects on the speed of the database query or rendering of the results at all? For example if there were eventually say 10,000 posts to filter, would either approach (meta vs taxonomy) have a performance benefit? Or does it make no difference whatsoever?
Thanks!
Trevor(Private) March 13, 2019 at 1:23 pm #205000Hi Oran
Taxonomy is faster, but won’t do numerical things like date ranges, range slider, sorting, etc.
This is because taxonomies are stored by their ID, so the SQL queries are always numeric comparisons, whereas post meta is often a string comparison which are generally slower. So post meta where numerical data should be used where you need to compare ranges like ranges (numbers or dates) or sorting, or taxonomy when the user wants a multiple “choice” scenario.
Anonymous(Private) March 13, 2019 at 2:09 pm #205012Thanks Trevor! And that applies to the queries that S&F runs as opposed to just regular WordPress taxonomy queries?
I’m not really a dev so don’t understand the finer details of it all, but does the fact that S&F is just querying it’s cache in the database rather than running ‘live’ search each time make any difference?
And I know it’s difficult to say as it depends on the server and number of visitors – but in real world terms, does it actually make a difference in the end? Will an S&F taxonomy query be noticeably faster for the end user than an S&F meta query do you think?
Thanks for bearing with me 🙂
-
AuthorPosts