Hi,
We've done some work with GiST indices and found a little problem
with optimizer. The problem could be reproduced with Gene's code
(link is in original message below). test data and sql I could send -
it's just 52Kb gzipped file. What is a reason for optimizer to decide
that sequential scan is better (look below for a numbers).
Implicite disabling of seq scan gave much better timings.
Regards,
Oleg
test=# explain select * from test where s @ '1.05 .. 3.95';
NOTICE: QUERY PLAN:
Seq Scan on test (cost=0.00..184.01 rows=5000 width=12)
EXPLAIN
% ./bench.pl -d test -b 100
total: 3.19 sec; number: 100; for one: 0.032 sec; found 18 docs
test=# set enable_seqscan = off;
SET VARIABLE
test=# explain select * from test where s @ '1.05 .. 3.95';
NOTICE: QUERY PLAN:
Index Scan using test_seg_ix on test (cost=0.00..369.42 rows=5000 width=12)
EXPLAIN
% ./bench.pl -d test -b 100 -i
total: 1.71 sec; number: 100; for one: 0.017 sec; found 18 docs
On Mon, 27 Nov 2000 [EMAIL PROTECTED] wrote:
> Date: Mon, 27 Nov 2000 12:36:42 -0600
> From: [EMAIL PROTECTED]
> To: Tom Lane <[EMAIL PROTECTED]>
> Cc: 'pgsql-general ' <[EMAIL PROTECTED]>,
> 'pgsql-hackers ' <[EMAIL PROTECTED]>
> Subject: Re: [HACKERS] Indexing for geographic objects?
>
> Tom Lane wrote:
> > Michael Ansley <[EMAIL PROTECTED]> writes:
> > > Remember also that the GiST library has been integrated into PG, (my brother
> > > is doing some thesis workon that at the moment),
> >
> > Yeah? Does it still work?
>
> You bet. One would otherwise be hearing from me. I depend on it quite
> heavily and I am checking with almost every release. I am now current
> with 7.0.2 -- this time it required some change, although not in the c
> code. And that's pretty amazing: I was only screwed once since
> postgres95 -- by a beta version I don't remember now; then I
> complained and the problem was fixed. I don't even know whom I owe
> thanks for that.
>
> > Since the GIST code is not tested by any standard regress test, and is
> > so poorly documented that hardly anyone can be using it,
> I've always
> > assumed that it is probably suffering from a severe case of bit-rot.
> >
> > I'd love to see someone contribute documentation and regression test
> > cases for it --- it's a great feature, if it works.
>
> The bit rot fortunately did not happen, but the documentation I
> promised Bruce many months ago is still "in the works" -- meaning,
> something interfered and I haven't had a chance to start. Like a
> friend of mine muses all the time, "Promise doesn't mean
> marriage". Boy, do I feel guilty.
>
> It's a bit better with the testing. I am not sure how to test the
> GiST directly, but I have adapted the current version of regression
> tests for the data types that depend on it. One can find them in my
> contrib directory, under test/ (again, it's
> http://wit.mcs.anl.gov/~selkovjr/pg_extensions/contrib.tgz)
>
> It would be nice if at least one of the GiST types became a built-in
> (that would provide for a more intensive testing), but I can also
> think of the contrib code being (optionally) included into the main
> build and regression test trees. The top-level makefile can have a
> couple of special targets to build and test the contribs. I believe my
> version of the tests can be a useful example to other contributors
> whose code is already in the source tree.
>
> --Gene
>
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83