Re: Weird indices

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Joseph Shraibman <jks(at)selectacast(dot)net>
Cc: Jean-Christophe Boggio <cat(at)thefreecat(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: Weird indices
Date: 2001-02-20 01:32:45
Message-ID: Pine.BSF.4.21.0102191725460.85278-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Mon, 19 Feb 2001, Joseph Shraibman wrote:

> Stephan Szabo wrote:
> >
> > Do you have a value that is not null that is very common?
> > It's estimating that there will be 10113 rows that match
> > nomsession='xxx' which makes a seq scan a much less bad plan.
> >
> Err, why? There is an index, isn't there? Shouldn't the index allow
> postgres to quickly find the %2 of rows that would match?

Right now it has to go to the heap file to find out whether or not
a row is currently visible to the transaction which means potentially
alot of seeks and reads from the heap file which can be more expensive
than just sequentially reading from the heap file depending on a bunch
of things such as how wide the rows are (if there are 100 rows per
block in the heap file and 500000 rows, you need to do 5000 reads.
If you are looking for 10000 rows in that file, you're likely (always?)
going to end up doing 10000 heap file reads plus the reads on the
index file.)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-02-20 01:48:42 Re: Weird indices
Previous Message Bruce Momjian 2001-02-20 01:31:51 Re: PHP4 Persistent Connection