2 ms·
> Database [anything] Honestly, the author couldn't have chosen a worse example if they tried. RDBMS are so absurdly complex and have so many edge cases for ev
by sgarland 1y ago
> Database [anything]
Honestly, the author couldn't have chosen a worse example if they tried. RDBMS are so absurdly complex and have so many edge cases for everything, that they are my canonical answer to why it's a bad idea to have dev teams managing them, or designing schema. Disclaimer: I'm a DBRE.
Look at MySQL's ORDER BY [0], GROUP BY [1], and index merge [2] optimizations. Postgres' ORDER BY optimization [3] doesn't have nearly as many gotchas, but it more than makes up for it by having many more types of indices [4], as well as many types of operator classes within each of those. While you're at it, you should probably have a handle on collations [6], AKA "why did this ORDER BY do something odd?"
> You could learn about the data structures that represent the index
You mean a B+ tree (for standard types)? I would hope you covered that in DS&A already.
> about all the tricks that go into updating them efficiently
> But it will very rarely inform the database migration or query you’re writing.
I disagree. For example, if you didn't know that updating any indexed column in a Postgres table means the entire row is re-written (hope you haven't done anything silly, like storing medium-sized JSON blobs that aren't quite big enough to trigger TOAST), you would likely be much more cavalier with your indexing decisions.
I'm so very tired of the "I don't need to know how the things I use work" attitude. Do you need to be able to write your own database to effectively use one? No, of course not. Should you have read the official docs? Yes. You'll learn far more than from skimming random blogs and YouTube videos.
[0]: https://dev.mysql.com/doc/refman/8.0/en/order-by-optimization.html https://dev.mysql.com/doc/refman/8.0/en/order-by-optimizatio...
[1]: https://dev.mysql.com/doc/refman/8.0/en/group-by-optimization.html https://dev.mysql.com/doc/refman/8.0/en/group-by-optimizatio...
[2]: https://dev.mysql.com/doc/refman/8.0/en/index-merge-optimization.html https://dev.mysql.com/doc/refman/8.0/en/index-merge-optimiza...
[3]: https://www.postgresql.org/docs/current/indexes-ordering.html https://www.postgresql.org/docs/current/indexes-ordering.htm...
[4]: https://www.postgresql.org/docs/current/indexes-types.html https://www.postgresql.org/docs/current/indexes-types.html
[5]: https://www.postgresql.org/docs/current/indexes-opclass.html https://www.postgresql.org/docs/current/indexes-opclass.html
[6]: https://www.postgresql.org/docs/current/collation.html https://www.postgresql.org/docs/current/collation.html