Re: Proximity query with GIST and row estimation

From: "Guillaume Smet" <guillaume(dot)smet(at)gmail(dot)com>
To: "Paul Ramsey" <pramsey(at)refractions(dot)net>
Cc: "Pg Performance list" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Proximity query with GIST and row estimation
Date: 2007-02-15 16:13:34
Message-ID: 1d4e0c10702150813p19df3108sf2a7c82c38360a0a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 2/14/07, Paul Ramsey <pramsey(at)refractions(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Alvaro Herrera 2007-02-15 16:27:33 Re: Question about Bitmap Heap Scan/BitmapAnd
Previous Message Guillaume Smet 2007-02-15 16:05:25 Re: Question about Bitmap Heap Scan/BitmapAnd