araza@xxxxxxxx wrote:
Hi,
I have a GiST index on st_geometry type (a user defined type). It looks
like index is not getting hit when I use some geometric operator. Here
is the example of st_contains operator.
<snip>
How can I force or direct the planner to use the GiST index? Am I
missing something?
For the index to be used you need to use an operator that can make use
of it. eg something like:
select parcel1.id, count(*) from parcel1, polygons where
contains(polygons.the_geom, parcel1.the_geom) and parcel1.geom &&
polygons.the_geom group by parcel1.id;
the && (inside bounding box) is able to use the gist index, whilst the
exact contains is not able to.
Hope that helps,
Joe