Here at BePro Software, we have been a major advocate of abandoning the wordpress custom taxonomies when it comes to searching, comparing and filtering multiple data points. In this tech article, we will demonstrate why this approach (seen in many plugins and themes), cannot scale to large numbers of results or users, without having major negative effects on performance. We will also showcase the high tech alternatives that our developers employ, to provide the fastest search results regardless or data size or visitor load

STORING CUSTOM TAXONOMIES

Categories are examples of custom taxonomies, they group data. However, gathering one single piece of information takes a minimum of 3 table queries/joins (wp_terms, wp_term_taxonomies and wp_term_relationships). When it comes to comparing multiple taxonomies, this situation is already heading in the wrong direction for anyone familiar with databases. Lets simplify this article with a use case. Lets say we want to query real estate records. You need to know, # of rooms, # of baths, cost, address and title. Now in that list, title would be the only thing available in a single wordpress table. Everything else would be stored as a custom taxonomy. For every single record that’s searched the, # of rooms, # of baths, address and cost will each have to reference those 3 tables mentioned earlier. So one record would cost (3 calls/joins * 4 records) = 12 calls plus the typical wordpress requests. This is a best case scenario where you know what you are looking for, compared to looking for something “LIKE” your search term or within a range of your search term. In addition, lets now say that you want to compare these results and filter them. You quickly see this is an exponential problem that will degrade as your data size increases and the number of comparison factors increase. You can also clearly see the issue on its way when considering multiple visitors making that many table requests.

ALTERNATIVE APPROACH

Its obvious to see that this approach will not scale. We cant blame wordpress for creating custom taxonomies, they have their use and we use them with our products. I mean, you are using wordpress after all, you got to at least have categories… Maybe even tags…. However, you should blame developers for lacking the technical skill to avoid using these mechanisms for searching and comparing multiple pieces of data. Instead, checkout our BePro Listings plugin. It stores most of its information outside of wordpress, refining the storage process and keeping search speeds dependable. Instead of burying data 3 joins deep, we create or use existing tables for data exposed to search and filter. So in the example we provided before, # of rooms, # of baths, cost and address all have their own column in a database table. This approach keeps the cost to retrieve and compare records at a steady dependable rate

WHY DO THEMES AND PLUGINS USE IT?

There are several answers to this. For one, its convenient and easy to use custom taxonomies. For a developer, it can mean the difference between a few lines of code and hundreds or even thousands of lines. For most designers and entry level developers, this is too much of a hurdle. Its far easier to use the simple functions provided by wordpress and concentrate on the design elements which attract customers Its also flexible. A theme or plugin can easily feature the ability to add/edit/delete custom taxonomies. For some, this flexibility to control the available search features, exactly as they envision is alluring. With this approach, there are only a few limitations to what you can search Another answer is laziness and betting. Developers are betting that you wont hit that performance wall. A large percentage of wordpress purchasers either never use their purchases or use them long after purchase. Even when used, it usually takes a while to populate large amounts of content and have the visitor traffic to really see the product deteriorate under pressure. It comes down to the buying process really. Typically, if something looks nice and seems to work with test data, customers seldom ask how it works or the server specs. These questions often come too late, long after the product is purchased and your website is finally getting traction.

CONCLUSION

Don’t be fooled by flashy designs and promises of flexibility. Trading convenience for performance, works well for small use cases only. In the end, you will have to graduate to a purpose built platform that goes beyond the $60 theme you purchased. If your website depends on the ability to search and filter through large sums of custom data, then you need a solution that offers more than custom taxonomies. Now you understand how this data is stored, its easy to see how its impossible to scale for large data sets or visitor traffic. Then again, if your plan is to have a small website, maybe it doesn’t matter


Date: WordPress Custom Taxonomy Search / filter flawed was last modified: June 1st, 2015 by BePro Software Team Management at BeProSoftware.com

Leave a Reply