Re:A terrible schema from a clueless programmer
by Tanjreeve on Sunday November 07, 2021 @08:15AM
(#29139200)
There are databases out there that analyse usage and filtering patterns and will generate and drop indexes automatically. That is a benefit to some people (normally more analytical workloads than critical production workloads for obvious reasons).
Re:A terrible schema from a clueless programmer
by marginalia_nu on Sunday November 07, 2021 @09:46AM
(#29139818)
Most databases offer some sort of optimization tooling, not all of it automatic. You just gotta know it's there.
In this case, I don't think the 3NF-solution they came up with was necessary, it typically ends up requiring really complicated transactions and in some cases it may even be slower because of cache thrashing. What they really needed was to index their table. You can index strings, that's fine. It's reasonably fast, like even with a hundred million rows it's doable.
"But why doesn't the database build indices automatically?", I hear someone about to type, it's because indices make inserts slower and require more memory. In many cases auto-indexing would probably help, but it would break a lot of use-cases too.