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

Re: About index ...

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pejac(at)altern(dot)org
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: About index ...
Date: 2000-10-11 14:38:10
Message-ID: 22708.971275090@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
<pejac(at)altern(dot)org> writes:
> an doesn't work with select * from test where id < 45.
> EXPLAIN
> Seq scan on test

The system doesn't believe that WHERE clause is selective enough to be
efficiently done as an indexscan.  An indexscan will be slower than a
seqscan unless it is able to visit just a small fraction of the rows
in the table, and a one-sided inequality doesn't guarantee that.

If 45 happens to be near the bottom of the range of ID values in this
table, then indeed an indexscan might be a reasonable implementation.
But the planner won't know the range of values unless you've done a
VACUUM ANALYZE on this table.

			regards, tom lane

In response to

pgsql-novice by date

Next:From: devalDate: 2000-10-11 15:31:12
Subject: assertion
Previous:From: Gerhard KroderDate: 2000-10-11 09:05:14
Subject: mail-test, just discard

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