Re: Indexing for geographic objects?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
Cc: selkovjr(at)mcs(dot)anl(dot)gov, "'pgsql-hackers '" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Indexing for geographic objects?
Date: 2000-12-08 17:59:27
Message-ID: 1127.976298367@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Oleg Bartunov <oleg(at)sai(dot)msu(dot)su> writes:
>> 5000 looks like a suspiciously round number ... how many rows are in
>> the table? Have you done a vacuum analyze on it?

> about 10,000 rows,

So the thing is estimating 0.5 selectivity, which is a fallback for
operators it knows nothing whatever about.

[ ... digs in Selkov's scripts ... ]

CREATE OPERATOR @ (
LEFTARG = seg, RIGHTARG = seg, PROCEDURE = seg_contains,
COMMUTATOR = '~'
);

CREATE OPERATOR ~ (
LEFTARG = seg, RIGHTARG = seg, PROCEDURE = seg_contained,
COMMUTATOR = '@'
);

Sure 'nuff, no selectivity info attached to these declarations.
Try adding

RESTRICT = contsel, JOIN = contjoinsel

to them. That's still an entirely bogus estimate, but at least
it's a smaller bogus estimate ... small enough to select an indexscan,
one hopes (see utils/adt/geo_selfuncs.c).

I have not dug through Gene's stuff to see which other indexable
operators might be missing selectivity estimates, but I'll bet there
are others. If you have the time to look through it and submit a
patch, I can incorporate it into the version that will go into contrib.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message The Hermit Hacker 2000-12-08 18:03:54 Re: Indexing for geographic objects?
Previous Message Bruce Momjian 2000-12-08 17:50:17 Re: [HACKERS] Trip to Japan

Browse pgsql-hackers by date

  From Date Subject
Next Message The Hermit Hacker 2000-12-08 18:03:54 Re: Indexing for geographic objects?
Previous Message Bruce Momjian 2000-12-08 17:50:17 Re: [HACKERS] Trip to Japan