Re: Seq. scan when using comparison operators, why? [netaktiv.com #150] - Mailing list pgsql-general

From Tom Lane
Subject Re: Seq. scan when using comparison operators, why? [netaktiv.com #150]
Date
Msg-id 20458.1018275305@sss.pgh.pa.us
Whole thread Raw
In response to Seq. scan when using comparison operators, why? [netaktiv.com #150]  (Stephane Bortzmeyer <bortzmeyer@netaktiv.com>)
Responses Re: Seq. scan when using comparison operators, why? [netaktiv.com #150]  (Stephane Bortzmeyer <bortzmeyer@netaktiv.com>)
List pgsql-general
Stephane Bortzmeyer <bortzmeyer@netaktiv.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

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: inherited columns as foreign keys WAS "no subject"
Next
From: Tom Lane
Date:
Subject: Re: numeric test on RiscPC