# 2.2 GIN & GiST ![The GIN Corkboard](assets/arch_index_gin.png) Sometimes, the elephant needs to find something more complex than a simple ID. Sometimes it needs to find every book that contains the word "Peanuts" or every suitcase that contains a "Red Sock." For this, the elephant uses specialized indexes like **GIN** and **GiST**. ## The GIN Corkboard (Generalized Inverted Index) Imagine a frantic **Word Scavenger Bird** highlighting specific words in every book and then pinning those words to a giant corkboard. Each word on the board has dozens of strings leading to different books across the floor. If you ask for "Peanuts," the bird doesn't search the books; it just finds the pin for "Peanuts" and follows the strings. ## The GiST Gallery (Generalized Search Tree) GiST is like a **Gallery of Shapes**. Instead of words, it sorts things by "neighborhoods." Is this point inside this circle? Is this box overlapping that box? It’s a B-Tree that learned how to draw. For the gritty details on how these collections are managed, check out the [[Structures/Index|GIN Reference]] and the [[Structures/Index|GiST Reference]]. --- [[Chapter 2/2.1 - The B-Tree|← 2.1 - The B-Tree]] | [[Chapter 2/2.0 - The Mighty Indexes|↑ 2.0 - The Mighty Indexes]] | [[Chapter 2/2.3 - BRIN|2.3 - BRIN β†’]]