Re: Seq. scan when using comparison operators, why? [netaktiv.com #150]

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephane Bortzmeyer <bortzmeyer(at)netaktiv(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Seq. scan when using comparison operators, why? [netaktiv.com #150]
Date: 2002-04-08 14:15:05
Message-ID: 20458.1018275305@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Stephane Bortzmeyer <bortzmeyer(at)netaktiv(dot)com> writes:
> I have an index on column "numero". When, I use a WHERE numero=8,
> PostgreSQL uses an index scan (OK) but no when using comparison
> operators like numero>8.

That is the default behavior in the absence of any VACUUM ANALYZE
stats (and your explains look suspiciously like default stats).

If you have stats then the choice will depend on how much of the table
the planner estimates will be scanned. An indexscan is generally not
a win for scanning more than a few percent of a table.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-04-08 14:18:23 Re: numeric test on RiscPC
Previous Message Tom Lane 2002-04-08 14:09:54 Re: inherited columns as foreign keys WAS "no subject"