Re: optimizer ignoring primary key and doing sequence scan

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: "Chris Hoy" <chris(dot)hoy(at)hoyc(dot)fsnet(dot)co(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: optimizer ignoring primary key and doing sequence scan
Date: 2008-07-14 20:08:53
Message-ID: dcc563d10807141308s29a6d32cx3b5e91c74cb80cbe@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Jul 14, 2008 at 1:54 PM, Chris Hoy <chris(dot)hoy(at)hoyc(dot)fsnet(dot)co(dot)uk> wrote:
>
> Hi
>
> I have a number of tables in my database where the queries appear to
> ignoring the primary key and doing a seq scan instead, however other tables
> appear to be fine. I can see any difference between them.
>
> Is their any way of determination why the otimizer isn't picking up the
> primary key?
>
> Version 8.3.3 windows
>
> An example of a non working table is:
>
> select * from industries where industryid = 1;
> "Seq Scan on industries (cost=0.00..1.02 rows=1 width=116) (actual
> time=0.011..0.013 rows=1 loops=1)"

According to this there's only one row in the table. why WOULD
postgresql use an index when it can just scan the one row table in a
split second.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2008-07-14 20:21:00 Re: SPACE FOR POSTGRESQL DATABASE
Previous Message Chris Hoy 2008-07-14 19:54:31 optimizer ignoring primary key and doing sequence scan