Using B-Tree index for such kind of queries (with '>','<')

From: "Andrzej Zeja" <kinaz(at)eden(dot)tu(dot)kielce(dot)pl>
To: <pgsql-cygwin(at)postgresql(dot)org>
Subject: Using B-Tree index for such kind of queries (with '>','<')
Date: 2002-05-06 13:39:05
Message-ID: 002101c1f503$64ac6050$95d1a4c3@tu.kielce.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-cygwin pgsql-general

Hi

I've got table Test and index for this table B-Tree type.
and
I've made query like:
Select * from test where Id<100;
During execution Optimizer makes no use of the index.
In documentation stands that using B-Tree index is used for such kind of queries (with '>','<').
Everything works fine only for '=' comparision.

Why it doesn't work in my case?
Why Sequenced Scan is executed instead of indexed scan?

Below is output of my query:
template1=# explain select * from test where id > 100;
NOTICE: QUERY PLAN:
Seq Scan on test (cost=0.00..1.06 rows=3 width=18)
NOTICE: QUERY PLAN:
Seq Scan on test (cost=0.00..1.06 rows=3 width=18)

Andrzej

Responses

Browse pgsql-cygwin by date

  From Date Subject
Next Message Joel Burton 2002-05-06 14:25:00 Re: [CYGWIN] Using B-Tree index for such kind of queries (with '>', '<')
Previous Message Liviu Taloi 2002-05-06 09:45:54 The service did not respond to the start..

Browse pgsql-general by date

  From Date Subject
Next Message Lincoln Yeoh 2002-05-06 13:47:28 Re: HOWTO - Random character generation for primary key
Previous Message Bertin, Philippe 2002-05-06 11:31:04 IF- statements in a rule's 'DO INSTEAD SELECT ...'- statement