5 ms·
> Dynamic content uses about 200 SQL statements per webpage. Genuinely curious, what kind of page would require 200 queries? I've written plenty of moderately-
by petepete 9y ago
> Dynamic content uses about 200 SQL statements per webpage.
Genuinely curious, what kind of page would require 200 queries? I've written plenty of moderately-complex applications and don't think I've come close to 10% of that on a single (non-crazy dashboard) page.
- TimWolla 9y agoIt doesn't say "require". Possibly they are selecting the same information over and over again, instead of passing it along the different functions, because it is fast enough.
- krylon 9y agoEven so, querying data once and reusing it is usually the more maintainable option and probably means less code, too. It is not only about performance. (And just to be clear, for my use cases, I have been very happy with SQLite's performance.)
- hinkley 9y agoThis requires an information architecture and these days those seem to be harder to come by. I think we may be favoring velocity over Stop and Think time a bit too much. (If you’re thinking, “no dummy, just use caching” then I regret to inform you that cache invalidation and eviction without an info architecture are as hard if not harder. And caching bugs make you look like a clown in front of your bosses. Because the whack-a-mole process never looks professional)
- ju-st 9y agoClick on the linked site (or: https://sqlite.org/np1queryprob.html https://sqlite.org/np1queryprob.html ), the sqlite project explains it
- petepete 9y agoAh, thank you. Explains it perfectly.
- zimpenfish 9y agoA Wordpress page with 12 posts will do 60 queries - shamusyoung.com/twentysidedtale/?p=41607 I should imagine something running on a generic ORM (ie without the optimised queries) would use considerably more (Rails, IIRC, will often do two queries to load a single object.)
- qlm 9y agoWorst I've seen is a CMS site which, with caching disabled, used upwards of 40,000 queries to load the homepage.
- shoover 9y agoPlease tell me you held down the zero key accidentally ;)
- hinkley 9y agoWhen the app is being dumb, people put caching in to hide the data flow problems. When the data flow problems are hidden, they multiply, and then turning it off again is highly improbable. Caching has sucked all the fun out of too many projects I’ve been associated with. Do cache headers and cache busting first. You can always put a transparent cache in front of your REST endpoints in prod. After debugging the browser caching. Don’t write your own caching implementation. Please.
- jackhack 9y agoLet me introduce you to the Rails ORM...
- collyw 9y agoIts common for people who don't know the Django ORM well to use it in a way that produces a lot of queries.
- Cyberdog 9y agoUnoptimized Drupal sites of moderate complexity with caches disabled (a use case only intended for development workflows, but it's of course quite simple to run a live site under such situations) can easily invoke 200-400 queries per page load.