[wp-hackers] Database structure Wordpress
mrmist
listswphackers at mist.org.uk
Thu Dec 3 19:36:16 UTC 2009
In message
<161617690912030712v5edc0858uc8b6d9bfaef26260 at mail.gmail.com>, Otto
<otto at ottodestruct.com> writes
>
>It's all well and good to have good database design, but the
>difference is that good design does not equate to "faster" in real
>world applications. The goal of "high performance" is often in direct
>conflict with correct relational database design. Took me a long time
>before I figured that one out.
>
One table per type in the way that's been described is not good
relational design in any case, it's breaking normalisation rules. If
you were to introduce a table for "car" and a table for "van" and they
ultimately contain the same information columns, that's poor design, and
will lead to you having to do work in the code base which could
otherwise have been done more efficiently through set based SQL.
For example, in that case, you'd also need another table that holds the
names of all the sub-tables, and to fetch everything you'd first have to
collect all the sub-table names with one query, then loop through N more
queries for each sub-table, or pass through horrific unions in your
database calls. It's just messy.
The "multiple tables for the same thing" sort of design thinking tends
to be favoured by programmer types more than database types.
Fair enough, you can abstract if you like, but it should be conforming
to rules, and doing that does tend to lead to reasonably complex
database designs which might not be the fastest.
--
mrmist
More information about the wp-hackers
mailing list