1

In order to define a GIN index on an array and scalar field (for example) you need to enable the btree_gin extension in PostgreSQL. Then you can define your indexes as a GIN index.

However I don't understand if, under the hood, PostgreSQL is using a btree structure or a GIN structure.

a_horse_with_no_name
  • 69,148
  • 13
  • 135
  • 173
collimarco
  • 363
  • 4
  • 13

2 Answers2

0

The resulting index is a true blood GIN index. These operator classes are not installed by default because they are rarely needed.

A single-column GIN index on a column of scalar type would be inferior to a B-tree index in almost every way.

a_horse_with_no_name
  • 69,148
  • 13
  • 135
  • 173
Laurenz Albe
  • 30,193
  • 3
  • 26
  • 50
0

Both. GIN indexes internally make use of a btree data structure. It is not identical to the btree data structure used in a proper BTREE index, but they share the same principles.

jjanes
  • 30,690
  • 3
  • 30
  • 41