From: | Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com> |
---|---|
To: | Greg Stark <gsstark(at)mit(dot)edu> |
Cc: | pgsql-sql <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Gist indexes on int arrays |
Date: | 2003-03-04 20:57:23 |
Message-ID: | Pine.LNX.4.44.0303041751190.31970-100000@matrix.gatewaynet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On 4 Mar 2003, Greg Stark wrote:
>
> Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com> writes:
>
> > Moreover if your array element positions that you want to compare
> > against(e.g attr_a[1], or attr_b[n], where n is the last element) are
> > known, then you could have a function "first" that returns
> > the first element ...
>
> Except that's precisely what I'm *not* doing. I'm treating the arrays as sets
> and looking for records where the set contains a given value. This is a
> denormalized table generated nightly from fully normalized raw data.
>
> So to simplify it, the query might have clauses like:
>
> WHERE foo_id = 900
> AND '{5}'::integer[] ~ attribute_set_array
>
> Right now I have a btree index on (foo_id).
>
> Can I have a GiST index on (foo_id, attribute_set_array) and have it be just
> as fast at narrowing the search to just foo_id = 900 but also speed up the ~
> operation?
I am afraid you cant do that easily. (but you can follow recent
discussions on the matter).
int4 does not have an opclass that can cope with "gist".
>
> Incidentally, it seems odd that there isn't an operator like ~ but optimized
> specifically for searching for a single item. It seems awkward and possibly
> unnecessarily slow to have to construct an array for the search parameter
> every time.
>
What do you mean by "slow"?
> --
> greg
>
--
==================================================================
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
Nikis 4, Glyfada
Athens 16610
Greece
tel: +30-210-8981112
fax: +30-210-8981877
email: achill(at)matrix(dot)gatewaynet(dot)com
mantzios(at)softlab(dot)ece(dot)ntua(dot)gr
From | Date | Subject | |
---|---|---|---|
Next Message | Jean-Luc Lachance | 2003-03-04 21:05:12 | Re: Forcing query to use an index |
Previous Message | Greg Stark | 2003-03-04 20:40:34 | Re: Gist indexes on int arrays |