Re: index scan on =, but not < ?

From: "Rick Schumeyer" <rschumeyer(at)ieee(dot)org>
To: "'Thomas F(dot)O'Connell'" <tfo(at)sitening(dot)com>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: index scan on =, but not < ?
Date: 2005-03-08 19:02:50
Message-ID: 002801c52411$6d510f40$0200a8c0@dell8200
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

That makes a lot of sense. Sure enough, if I change the query from
WHERE x > 0 (which return a lot of rows) to
WHERE x > 0 AND x < 1
I now get an index scan.

> As for why you see index usage in your first example query and not your
> second: compare the number of rows in question. An index is extremely
> useful if 19 rows will be returned. But when 62350411 rows will be
> returned, you're talking about a substantial fraction of the table. A
> sequential scan will probably correctly be judged to be faster by the
> planner.
>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Dennis Bjorklund 2005-03-08 19:04:55 Re: index scan on =, but not < ?
Previous Message John Arbash Meinel 2005-03-08 19:01:20 Re: index scan on =, but not < ?