5 ms·
Having built a few high load things with underlying SQL, I've found that in practice, big joins don't scale well, and caching becomes pretty important. It ofte
by procaryote 1y ago
Having built a few high load things with underlying SQL, I've found that in practice, big joins don't scale well, and caching becomes pretty important.
It often becomes more interesting to find what bits are reused in several places and can get broken out into a useful cache (like person id → person name, thumbnail url, person url, …) than making a custom query for each view
That completely changes how you do queries as you can cut a bunch of joins. Instead you get a partial data set from the query that you then throw on a function or service that populates all the referenced ids from a cache, and backfills (and caches) any missing ones (preferably with a single query for a list of people in the example).