Re: seqscan instead of index scan

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Martin Sarsale <martin(at)emepe3(dot)net>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: seqscan instead of index scan
Date: 2004-08-30 20:04:00
Message-ID: 20040830130016.T98089@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Mon, 30 Aug 2004, Martin Sarsale wrote:

> On Mon, 2004-08-30 at 15:06, Merlin Moncure wrote:
> > create function is_somethingable (ctype, dtype) returns boolean as
>
> Thanks, but I would prefer a simpler solution.
>
> I would like to know why this uses a seqscan instead of an index scan:
>
> create index t_idx on t((c+d));
> select * from t where c+d > 0;

As a geuss, since 7.4 and earlier have no statistics on the distribution
of c+d it has to guess about how likely that is to be true and is probably
overestimating. 8.0beta might handle this better.

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Greg Stark 2004-08-30 20:18:39 Re: Why does a simple query not use an obvious index?
Previous Message Bruno Wolff III 2004-08-30 19:40:50 Re: Why does a simple query not use an obvious index?