Let's have a table:
usr | terms |
---|---|
usr1 | [v1,v2] |
usr1 | [v3] |
usr1 | [v1] |
usr2 | [v1] |
usr2 | [v2] |
and assume we create a multi-column GIN index on it.
CREATE INDEX my_gin_ix ON items USING gin (usr,terms);
What will the B-Tree of keys look like?
From the docs (and postgres repo) I see that each B-Tree node should have a column identifier and a key extracted from the field (each field can result in multiple keys), but I can't find any example that would clarify whether the individual columns of the same row end up being "subtrees" of each other or whether they are indexed as independent values.
In other words if I run the query usr = 'usr1' AND terms @> array['v1']
will the DB:
a. find usr1
and then in its subtree find a node with v1
which will
yield a single posting list or
b. find usr1
and the associated posting list and then separately search for v1
and fetch the associated posting list and then
compute the intersection of the two posting lists?