[wp-hackers] when to use custom database tables

Mike Schinkel mikeschinkel at newclarity.net
Thu Dec 8 18:01:21 UTC 2011


On Dec 8, 2011, at 11:24 AM, Eric Mann wrote:
> ... Disclaimer - this is only my opinion based on personal experience and
> is in no way a "rule" ...
> 
> The only time you should be using custom tables is when you need to index
> particular data fields for your content and the indexing features of custom
> meta fall short.  So if you wanted to build a geolocation database for a
> high-traffic website where sorting/filtering/indexing on multiple fields
> was vital to business (for example), you might consider using a custom
> table or two to store data.
> 
> Just remember, there are tradeoffs to custom tables - CPTs come with all
> the richness and goodness of the existing WordPress API (WP_Query,
> taxonomies, etc).  Once you start delving in to custom tables, you'll be
> spending more time reinventing the wheel than actually using the data.
> 
> So without detailed specs, my general guideline would be to only use custom
> tables if the project *absolutely requires them*.  Most projects don't,
> though most of us are convinced a custom table would be easier than a CPT
> with copious meta fields.

I'll *strongly* second that opinion.

-Mike


More information about the wp-hackers mailing list