tl;dr:"In the rest of this post you’ll see where I started, what I went through, what I learned along the way, and how it slowly evolved into the finally chosen image. I will only show the mostly happy path here. I will also only show images that were fairly ok (discarding the other 70+% that were terrible)."
tl;dr:"How PostgreSQL row count estimation can go very wrong. In this case, domain knowledge will help us trick PostgreSQL into a different query plan which will be way faster, without adding any additional indices." Jacob shows us that query plans aren’t that hard to interpret with the right tools and how to rewrite queries to "achieve substantial performance boosts without unnecessary indices or denormalizing the data model."