Re: Fwd: Btree doesn't work with ">" condition

From: Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com>
To: Paolo Cassago <paolo(dot)cassago(at)talentmanager(dot)com>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fwd: Btree doesn't work with ">" condition
Date: 2001-11-16 16:28:59
Message-ID: 20011116082742.N18816-100000@megazone23.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 16 Nov 2001, Paolo Cassago wrote:

> I'm testing PostgreSQL, version 7.1.2, and I create a table,
> test1, with these kind of fields:
>
> CREATE TABLE test1 (
> id integer,
> content varchar
> );
>
> with 800.000 records, and a btree index setted on the id field.
>
> I noticed the query uses the index for "=" and "<" operators, but if
> the value used for the "<" operator is higher (600.000 for example),
> the query makes a seq scan of the table, and the index never works
> with the ">" operator. Am I managing the indexes well ?

Let's go through the standard things. :) Have you vacuum analyzed
the table? What does explain show for the queries (particularly the
row count). If the number of rows grabbed is a reasonable percentage
of the table, currently sequence scan *may* be faster than an index
scan, so this may not be incorrect.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephan Szabo 2001-11-16 16:33:04 Re: Further open item (Was: Status of 7.2)
Previous Message Alex Pilosov 2001-11-16 16:26:11 Re: Super Optimizing Postgres