Re: index not being used. Why?

From: Richard Huxton <dev(at)archonet(dot)com>
To: Gerardo Herzig <gherzig(at)fmed(dot)uba(dot)ar>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: index not being used. Why?
Date: 2007-03-09 15:59:48
Message-ID: 45F18474.4000207@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-sql

Gerardo Herzig wrote:
> -> Seq Scan on pages (cost=0.00..9.08 rows=408 width=55)

> Watch the last row of the explain command. It makes a sequential scan on
> the pages table, like it is not using the index on the "id" field.

You only have 408 rows in the table - it's probably not worth the
trouble of using an index and *then* fetching the rows. Especially since
it's going to match most of the pages anyway.

Try adding a few thousand rows, analyse and see if it decides to use the
index then.
--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Andrew Sullivan 2007-03-09 16:02:11 Re: index not being used. Why?
Previous Message Glen W. Mabey 2007-03-09 15:40:13 problem upgrading from 8.1.6 to 8.1.8 --- relation <tablename> does not exist

Browse pgsql-sql by date

  From Date Subject
Next Message Andrew Sullivan 2007-03-09 16:02:11 Re: index not being used. Why?
Previous Message Bruno Wolff III 2007-03-09 15:03:32 Re: [Re: PRIMARY KEY]