From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Paul Ramsey <pramsey(at)cleverelephant(dot)ca> |
Cc: | PostgreSQL <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: spgist index not getting used |
Date: | 2014-09-25 03:24:02 |
Message-ID: | 5459.1411615442@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Paul Ramsey <pramsey(at)cleverelephant(dot)ca> writes:
> My C implementation is herehttps://github.com/pramsey/postgis/blob/spgist/postgis/gserialized_spgist_2d.c
> My SQL binding calls are herehttps://github.com/pramsey/postgis/blob/spgist/postgis/gserialized_spgist_2d.sql
> Thanks to help from Andres Freund, I can now build an index based on my extension. However, when I run a query using the operator(s) I have defined, the query never uses my index, it always sequence scans.
> explain analyze select * from somepoints where '(5898.82450178266,7990.24286679924)'::point = pt;
(I assume that's a typo and you meant "... &=& pt")
As stated, this WHERE clause cannot be used with the index: indexable
clauses in PG are always of the form "indexed_column operator something",
and you've written it the other way round. I gather that you think the
operator is commutative; but since you didn't declare that, the planner
doesn't know it can flip the clause around. Try adding "commutator = &=&"
to the declaration of the "point &=& point" operator.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Paul Ramsey | 2014-09-25 03:33:48 | Re: spgist index not getting used |
Previous Message | Paul Ramsey | 2014-09-25 00:36:08 | Re: spgist index not getting used |