Unconference - Stream 1 - 15:45 - 16:45 - PGCon 2022

Explore the power of the key space in optimizing index scans, from B-trees and GIN indexes to Brin indexes, and learn how to simplify complex queries using these techniques.

Key takeaways
  • The key space is the main intuition generating thing, not physical blocks.
  • Hash indexes and regular indexes use the same index tuple representation.
  • Index scans can be optimized by considering the key space and using a sort node on top of the index scan.
  • The B-tree code can be used to implement MDAM type things like skip scan.
  • The GIN index code has similar machinery to the B-tree code.
  • The Brin index can be used to provide accurate statistics on what is not in blocks or what is in blocks but not necessarily because of the index.
  • The key space can be used to preserve page-at-a-time processing, which is key to not requiring duplicate elimination.
  • The B-tree scan can be optimized by using a cap on the number of concurrent scans in the tree.
  • The SQL query can be optimized by using a top-level sort and then merging the results.
  • The Gist index can be used to provide a smaller index that is orders of magnitude smaller than the original index.
  • The Brin index can be used to provide a range index on top of the BrinMinMaxes.
  • The B-tree code can be used to implement a range index on top of the BrinMinMaxes.
  • The key space can be used to simplify the index scan by considering only two block ranges.
  • The GIN index code has a lot of machinery that can be used to implement the Brin index.
  • The Brin index can be used to provide a range index on top of the BrinMinMaxes.
  • The B-tree code can be used to implement a range index on top of the BrinMinMaxes.
  • The key space can be used to simplify the index scan by considering only two block ranges.
  • The GIN index code has a lot of machinery that can be used to implement the Brin index.