[wp-hackers] Consolidating database tables and other assorted
items
Steve Lewis
stevelle at gmail.com
Mon Apr 9 19:56:13 GMT 2007
On 4/9/07, Computer Guru <computerguru at neosmart.net> wrote:
>
> Thank you Robert!
+1
Brilliant.
Database normalization almost always equals more tables - but hundred-fold
> flexibility.
>
More tables, I agree. Flexibility? I don't know about that.
I'm sure I missed one or two important things, but how a post + comments =
> 20 queries on a stock WP *without a single plugin* is beyond me.
>
> The thing is - since the WP data is well distributed and properly stored
> (the WP db-structure is fairly well done, with the exception of foreign keys
> IMO) why does it take so many queries to do so little?
Normalization increases the complexity of data retrieval, and therefore the
complexity of the queries necessary. The point of normalization is not to
simplify but to promote data integrity. With that level of complexity,
either you have to perform more queries, or more join operations within your
queries. The WP API discourages joins, generally. That is why it takes 20
queries to do so little.
You would have to begin de-normalizing the database, or consider using
views, to reduce the number of queries per page without cutting features.
I think if WP ever gets a database abstraction layer - even if it's
> something as heavy as MDB2/PearDB - it'll perform *better* since a hell of a
> lot of queries will be consolidated.
I doubt that. I seriously doubt that. Especially because it makes it
harder to perform the optimal joins for the current context. Abstractions
in the middleware defeat the value of the RDBMS. That is just the way it is
in my experience.
I would love to know why I am wrong.
--
SteveL
More information about the wp-hackers
mailing list