Skip site navigation (1) Skip section navigation (2)

Re: seq scan on a table whereas an index exist

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Nicolas GIMMILLARO <Nicolas(dot)GIMMILLARO(at)wmi(dot)fr>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: seq scan on a table whereas an index exist
Date: 2001-03-08 02:07:04
Message-ID: 24542.984017224@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Nicolas GIMMILLARO <Nicolas(dot)GIMMILLARO(at)wmi(dot)fr> writes:
> What's wrong with my "select * from web_access where date between
> '01/01/2001' and '06/03/2001' "  query ?

Nothing.  The planner is estimating that this query will retrieve a
sufficiently large fraction of the rows in the table that a seqscan
will be cheaper than an indexscan.  That estimate might or might not
be correct, but it's operating as designed.

The form with the subselects confuses the planner enough that it falls
back on default selectivity estimates, which do lead it to choose an
indexscan.

			regards, tom lane

In response to

pgsql-bugs by date

Next:From: Tom LaneDate: 2001-03-08 14:59:34
Subject: Depending on system install scripts (was Re: COBOL)
Previous:From: Tom LaneDate: 2001-03-08 00:42:40
Subject: Re: Pbm with aggregates on empty output

Privacy Policy | About PostgreSQL
Copyright © 1996-2013 The PostgreSQL Global Development Group