Re: Indexing an array? - Mailing list pgsql-sql

From Ron Mayer
Subject Re: Indexing an array?
Date
Msg-id 43221C42.2060605@cheapcomplexdevices.com
Whole thread Raw
In response to Indexing an array?  (Silke Trissl <trissl@informatik.hu-berlin.de>)
List pgsql-sql
Silke Trissl wrote:
> As far I could read from the documentation - this should be possible.
> But my question is, is there a kind of index on the array.

If your needs are a bit more modest (say, a few thousands instead of 
billions) the stuff in contrib/intarray works well; and if you
needed types other than integers you can you can look at intarray
to see how to build indexes on them and what those indexes
are useful for.

> Lets say, I want to get element 2,675,345,328. Does Postgres have to
> load the entire array into memory and then run through the 2.6 billion
> characters to return the one I want or does Postgres have an index - as
> where to find this element on disk?

Wouldn't you rather expect an index to be useful for finding which
rows match your query rather than for finding content within a row?


pgsql-sql by date:

Previous
From: "Wei"
Date:
Subject: How do I convert an integet to a timestamp?
Next
From: "Bjoern A. Zeeb"
Date:
Subject: user defined type, plpgsql function and NULL