[wp-hackers] when to use custom database tables

Eric Mann eric at eam.me
Thu Dec 8 16:24:16 UTC 2011


... 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.


On Thu, Dec 8, 2011 at 4:08 AM, Steve Taylor <steve at sltaylor.co.uk> wrote:

> Hi,
>
> I've managed every project so far with custom post types and
> taxonomies. However, I'm starting on a large project where I wonder if
> it might be better suited to using custom tables.
>
> Rather than detail all my specs, I'm just wondering, does anyone have
> any good rules of thumb for when custom tables become preferable to
> CPTs?
>
> I can give specs if necessary!
>
> Thanks,
>
> Steve Taylor
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list