Skip to content
Theory · Indexes Beyond the B-tree · lesson 3 of 14

GIN: the inverted index

Open a cookbook at its last pages. There is a subject index there: "syrniki: pages 12, 40, 77", "latte: pages 15, 40". Each word occurs in the book many times, and the index lists every page where it appears. To find a recipe with both syrniki and latte, you take the two page lists and look for the shared one, page 40.

In this lesson

  • The inverted index
  • Searching an array
  • JSONB and text
  • Common mistake
  • Key points