Re: index and queries using '<' '>' - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: index and queries using '<' '>'
Date
Msg-id 20041119141648.GA22737@wolff.to
Whole thread Raw
In response to Re: index and queries using '<' '>'  (Marc Boucher <pgml@gmx.net>)
Responses Re: index and queries using '<' '>'
List pgsql-general
On Fri, Nov 19, 2004 at 14:45:04 +0100,
  Marc Boucher <pgml@gmx.net> wrote:
> At 16:23 18/11/2004 +0100, Martijn van Oosterhout wrote:
> > The system seems to think that a scan is cheap because the table is so
> > small.
> The table currently contains just over 10000 elements. So 238 rows is a
> small part of it.

No, small is typically less than 1%. This depends on the size of the rows
and how much better accessing disk blocks sequentially is in your
enviroment and the size of your cache.

Because your table is so small it will probably all be cached after being
read through once, so you may want to tune your config settings to
say than random disk access costs only a little more than sequential
access. However, you need to be careful if your table is going to grow
a lot larger.

> Since the table is still growing, and the amount of rows in the reply of
> the query is quite uniform (it's not dependant on the size of the table), I
> hope that the statistics will evolve in a state that will force the use of
> the index.

Index scans aren't always faster than sequential scans.

pgsql-general by date:

Previous
From: Marc Boucher
Date:
Subject: Re: index and queries using '<' '>'
Next
From: Marc Boucher
Date:
Subject: Re: index and queries using '<' '>'