I have two indexes:
CREATE INDEX table_a_b ON table (a, b);
CREATE INDEX table_c_gin ON table USING GIN(c);
My queries look like this:
SELECT * FROM table WHERE a = 'test' and b = 1 and c @> '{"test1", "test2"}'::text[];
The query planner prints out this:
Index Scan using table_a_b on table (cost=0.13..8.15 rows=1 width=52)
Index Cond: (((a)::text = 'test'::text) AND (b = 1))
Filter: (c @> '{test1, test2}'::text[])
So is there any way I could make the GIN index work, too? Maybe there's a way to create a composite index with two different index types?
Appreciate any help.
aandb. Why would it use a more complicated (and I suspect more costly) GIN index? Is the planner's estimate wildly wrong? That would be the thing to look into if so.c.