3 ms·
Very hot take indeed. As with all things, it depends and use the query planner to measure what actually makes a difference. In our application we have one impo
by dajonker 3y ago
Very hot take indeed. As with all things, it depends and use the query planner to measure what actually makes a difference.
In our application we have one important join that actually makes things a lot faster than the denormalized alternatieve. The main table has about 8 references to an organization table. To figure out what rows should be selected for a particular organization, you could either query on those 8 columns, making a very big where/or clause. As it turns out, PostgreSQL will usually end up doing a full table scan despite any index you would create.
Instead, there is an auxiliary table with two columns, one for organization and one reference to the main table. Joining on this table simplifies the query and also turns out to be much faster.