Re:Speeding up SQL queries by orders of magnitude using UNION
by monoideism on Saturday March 20, 2021 @10:05PM
(#26527587)
A certain amount of denormalization can be helpful, but often there's a trade-off in terms of maintainability.
[ Parent
| on HN ]
Re:Speeding up SQL queries by orders of magnitude using UNION
by rovr138 on Saturday March 20, 2021 @10:17PM
(#26527632)
Not who you replied to.
But yes,
As an example, we keep our data normalized and add extra tables to do the operations we need. It’s expensive since we have to precompute, etc. But then on lookups it’s quicker.
Like everything, it depends on what you want to optimize for.
Re:Speeding up SQL queries by orders of magnitude using UNION
by jaredsohn on Sunday March 21, 2021 @12:21AM
(#26528083)
Yep, in my case we wanted to make user-facing queries fast (i.e. a reports page). The extra complexity (not much; we just have to remember when to update certain values in other tables when they change) is definitely worth it since load time dropped from 30 seconds sometimes to almost instant.
Denormalizing everything is definitely a pain; keeping data in sync in mongodb (which lacks traditional joins) on a previous project was not fun; now using postgresql.