Re: why Sequencial Scan when selecting on primary key of table? - Mailing list pgsql-performance

From Brian Tarbox
Subject Re: why Sequencial Scan when selecting on primary key of table?
Date
Msg-id 000001c3279c$79dc2d80$01000001@trouble
Whole thread Raw
In response to Re: why Sequencial Scan when selecting on primary key of table?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: why Sequencial Scan when selecting on primary key of table?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: why Sequencial Scan when selecting on primary key of table?  (Andrew Sullivan <andrew@libertyrms.info>)
List pgsql-performance
The primary key field is an integer and I have performed vacuum analyse but
that does not seem to change anything.

I've also heard that postgres will not indexes when JOINing tables.  Can
that really be true??

Brian


-----Original Message-----
From: pgsql-performance-owner@postgresql.org
[mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Tom Lane
Sent: Saturday, May 31, 2003 1:14 PM
To: Brian Tarbox
Cc: pgsql-performance@postgresql.org
Subject: Re: [PERFORM] why Sequencial Scan when selecting on primary key
of table?


"Brian Tarbox" <btarbox@theworld.com> writes:
> When I say "explain select * from Patient where Patient_primary_key = 100"
> I get sequential scan.

Perhaps Patient_primary_key is not an integer field?  If not, you need
to cast the constant 100 to the right type.  Or write '100' with
single quotes around it, which leaves Postgres to choose the constant's
datatype.  (Yeah, I know, it's a pain in the neck.  We've had a lot of
discussions about how to fix this without breaking datatype extensibility;
no luck so far.)

            regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org


pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: why Sequencial Scan when selecting on primary key of table?
Next
From: Rod Taylor
Date:
Subject: Re: why Sequencial Scan when selecting on primary key of table?