Postgres indexes under the hood
rcoh.me
rcoh.me
Then you have something, even if you forget how an R-tree works
Think of them as being much like a book index. A book index is useful because it's sorted, so you find something fast. It points to the pages the item is on. Same for a db. The table isn't usually sorted, but the index is and points to the required rows
If you're a book editor and the author adds, edits, or removes a section, you need to update the index
Want to lookup a word by it's suffix? You're gonna need to scan the whole book, or have an index of reversed words
Database indexes work the same way
People seem to get lost in the details. I know devs that understand the various index tree types, but don't understand why something is sargable or why dropping indexes before a bulk copy is faster
If people get lost in the details, they are not prepared to fully understand the big picture.
Joel Spolsky is right when he writes about the 'Law of Leaky Abstractions', but I'm not sure the average CRUD developer needs to know the gory nuts and bolts of his DBMS. Of course they need to know enough to reason effectively about good design, performance, security, etc, and more low-level knowledge is always a good thing.
As an extreme example, PHP programmers don't need to understand branch prediction and caches.
I agree that async/await leaks in places, such as in the surprising deadlocks that Stephen Cleary explains. I've met more than one pretty serious C# developer that wasn't aware of this. http://blog.stephencleary.com/2012/07/dont-block-on-async-co...
> the question is whether it is part of the API and explained or not
More broadly it's a question of pretending things can be wrapped up in tidy self-contained entities, and the idea that we can fully design away the messy details of reality. See also the Three Big Lies of C++ https://youtu.be/rX0ItVEVjHc?t=17m15s
In an ideal world you'd just take existing synchronous code and throw async/await keywords at it to make it async. The abstraction isn't quite that successful, of course.
See Stephen Cleary's AsyncEx library, which provides async-specific functionality such as AsyncLock, which doesn't exist in the standard library. https://github.com/StephenCleary/AsyncEx/wiki/AsyncLock
But all the page references would be wrong, too, after the author updates the text. That would not happen with a DB index and it's data pointers.
With further blog posts https://pgeoghegan.blogspot.co.uk/2017/11/pghexedit-rich-hex... and http://pgeoghegan.blogspot.co.uk/2018/01/exploring-sp-gist-a...
This is funny. On the rest of my blog post I use indices. For this post, I went with indexes because that's what PG calls them in the docs.
I feel your pain.
I (native US English speaker) typically interpret "indexes" as the plural of index as in "structure you use for fast key-value lookup". I interpret "indices" as the plural of index as in "lookup key".
Isn’t OED British? They recently took their dictionary behind a paywall (!!), but they recommend “indexes” while it appears accepted that it is the Americanized spelling nonetheless.