Thread: Indexing array columns.

Indexing array columns.

From
Joshua Marsh
Date:
I've been searching the manual looking for information about the effects of indexing an array column but haven't found any information as of yet. 

Does anyone have any information on how the indexes work for arrayed columns? 

Does/Can the index track each element in the array, or does it track only the array as a whole? 

How can I increase the speed of a query like: SELECT * FROM table WHERE 123 = ANY(array_of_ints); ?

Thanks,

Josh

Re: Indexing array columns.

From
Joe Conway
Date:
Joshua Marsh wrote:
> Does/Can the index track each element in the array, or does it track
> only the array as a whole?

Built in index support works on the array as a whole, not the individual
elements.

> How can I increase the speed of a query like: SELECT * FROM table WHERE
> 123 = ANY(array_of_ints); ?

See contrib/intarray.

Joe