[wp-hackers] when to use custom database tables

Steve Taylor steve at sltaylor.co.uk
Thu Dec 8 16:46:53 UTC 2011


Thanks Eric, makes sense. I don't have much of an idea of the scale of
the site yet, but it's the first one that has made me wonder if it
might end up benefiting from custom tables.

I think erring on the side of CPTs is probably a good idea, though,
and I'm not 100% I need custom tables, so I'll probably keep it
simple. I guess if the site is successful enough that CPTs queries
start impacting performance, there will be budget for porting to
custom tables :)

Cheers,

Steve


On 8 December 2011 16:24, Eric Mann <eric at eam.me> 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.
>
>
> 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
>>
> _______________________________________________
> 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