Re: cube_contains and indexing

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: cube_contains and indexing
Date: 2002-08-18 12:23:22
Message-ID: 20020818122322.GA7589@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Aug 17, 2002 at 21:02:43 -0400,
Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Bruno Wolff III <bruno(at)wolff(dot)to> writes:
> > I am playing around with the cube extension in contrib and was not able to
> > get cube_contains to use an index. I was able to get (what I believe to be)
> > an equivalent @ operation (cubement containment) to use indexes.
> > So I am either confused about there being a @ equivalent to cube_contains
> > or cube_contains should be an indexable operation but isn't (or at least
> > is harder to get to use an index).
>
> It says here (cube.sql.in) that the @ operator *is* cube_contains.
> Also, AFAICT both @ and ~ (the commutator operator, cube_contained)
> should be equally indexable. Can you show us your test case?
>
> regards, tom lane

A short example is:
cube=> explain select col1 from c where cube_contains('(-78,39),(-77,40)',col1);NOTICE: QUERY PLAN:

Seq Scan on c (cost=0.00..369.30 rows=6195 width=24)

EXPLAIN
cube=> explain select col1 from c where '(-78,39),(-77,40)' @ col1;
NOTICE: QUERY PLAN:

Index Scan using c_index on c (cost=0.00..71.87 rows=19 width=24)

If this really looks like a problem I can provide more details.
I am running 7.2.1 with the cube package added on.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvar Freude 2002-08-18 12:47:18 BYTEA, indexes and "like"
Previous Message Cornelia Boenigk 2002-08-18 11:32:21 About to update the PostgreSQL-Functions in the PHP Manual