I'm building a PHP+MySQL application for a large website, with 100.000+
records in the main table, each one with a lot of dependencies in other
SQL tables. Thus each page view requires many SQL queries and/or joins.
Since I want to optimize performance, I'm wondering whether it would be
better to serialize full objects instead and store them in a single
table's TEXT field. This way I could just retrieve the row and
unserialize it, avoiding other queries. So far this is my comparison:
Pros:
- only one query per page view
Cons:
- not only a bigger database, due to serialization overhead, but a
single HUGE table (does this slow down things more than doing many
queries?)
Of course there are other drawbacks I actually don't care, such as
getting a very PHP-specific database or limiting retrival to IDs.
Does anybody have any advice about this? (Other than "try and benchmark
it" :->)
Alessandro.
records in the main table, each one with a lot of dependencies in other
SQL tables. Thus each page view requires many SQL queries and/or joins.
Since I want to optimize performance, I'm wondering whether it would be
better to serialize full objects instead and store them in a single
table's TEXT field. This way I could just retrieve the row and
unserialize it, avoiding other queries. So far this is my comparison:
Pros:
- only one query per page view
Cons:
- not only a bigger database, due to serialization overhead, but a
single HUGE table (does this slow down things more than doing many
queries?)
Of course there are other drawbacks I actually don't care, such as
getting a very PHP-specific database or limiting retrival to IDs.
Does anybody have any advice about this? (Other than "try and benchmark
it" :->)
Alessandro.
Comment