Re: Proximity query with GIST and row estimation - Mailing list pgsql-performance

From Guillaume Smet
Subject Re: Proximity query with GIST and row estimation
Date
Msg-id 1d4e0c10702150813p19df3108sf2a7c82c38360a0a@mail.gmail.com
Whole thread Raw
In response to Re: Proximity query with GIST and row estimation  (Paul Ramsey <pramsey@refractions.net>)
Responses Re: Proximity query with GIST and row estimation  ("Guillaume Smet" <guillaume.smet@gmail.com>)
List pgsql-performance
On 2/14/07, Paul Ramsey <pramsey@refractions.net> wrote:
> You'll find that PostGIS does a pretty good job of selectivity
> estimation.

So I finally have a working PostGIS and I fixed the query to use PostGIS.

The use of PostGIS is slower than the previous cube/earthdistance
approach (on a similar query and plan). But you're right, it does a
pretty good job to calculate the selectivity and the estimations are
really good.
It helps to select a good plan (or a bad one if the previous false
numbers led to a better plan which is my case for certain queries).
I suppose it's normal to be slower as it's more precise. I don't know
which approach is better in my case as I don't need the precision of
PostGIS.

For the record, here is what I did:
select AddGeometryColumn('lieu','earthpoint',32631,'POINT',2);
update lieu set earthpoint=Transform(SetSRID(MakePoint(wgslon,
wgslat), 4327), 32631);
create index idx_lieu_earthpoint on lieu using gist(earthpoint
gist_geometry_ops);

analyze lieu;

select numlieu, nomlieu, wgslon, wgslat, astext(earthpoint) from lieu
where earthpoint && Expand(Transform(SetSRID(MakePoint(12.49244400,
41.89103400), 4326), 32631), 3000);

(3000 is the distance in meters)

--
Guillaume

pgsql-performance by date:

Previous
From: "Guillaume Smet"
Date:
Subject: Re: Question about Bitmap Heap Scan/BitmapAnd
Next
From: Alvaro Herrera
Date:
Subject: Re: Question about Bitmap Heap Scan/BitmapAnd