3 ms·
> [Is 200 SQL statements] a ridiculously high number for a single page? It is, but it does happen, usually due to design decisions. When I was still young eno
by majewsky 10y ago
> [Is 200 SQL statements] a ridiculously high number for a single page?
It is, but it does happen, usually due to design decisions.
When I was still young enough to do PHP (about a decade ago), one of my largest projects was a domain-specific CMS for code collaboration. It was all working fine on my development system, but in production, every page loaded for at least 4-5 seconds. I inspected into the DB queries that were used to build a single page, and found a lot of duplicate
SELECT * FROM {table} WHERE id = {id};
because of how the model classes were built. Since it was too late to change the architecture, I sent these types of statements through a simple cache and brought the amount of queries per page down from a few hundred to below 10.