Re: select distinct, index not used

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Guettler <hv(at)tbz-pariv(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: select distinct, index not used
Date: 2009-04-16 15:29:25
Message-ID: 18380.1239895765@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thomas Guettler <hv(at)tbz-pariv(dot)de> writes:
> why does the statement take so long? The column 'lieferant' is indexed. But
> a sequential scan gets done.

It might have something to do with the fact that the planner's idea of
the size of the table is off by a factor of more than 100:

> -> Seq Scan on foo_abc_abc (cost=0.00..468944.11 rows=15404611 width=8) (actual time=0.029..125458.870 rows=115830 loops=1)

You might need to review your vacuuming policy.

(However, a full table indexscan isn't going to be particularly fast in
any case; it's often the case that seqscan-and-sort is the right
decision. I'm not sure this choice was wrong.)

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Robert Haas 2009-04-16 15:36:54 Re: [GENERAL] Performance of full outer join in 8.3
Previous Message Grzegorz Jaśkiewicz 2009-04-16 15:27:32 Re: select distinct, index not used