162 points · by rusbus · 8y ago · 23 comments
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.
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.