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

From Tom Lane
Subject Re: why Sequencial Scan when selecting on primary key of table?
Date
Msg-id 21073.1054401227@sss.pgh.pa.us
Whole thread Raw
In response to why Sequencial Scan when selecting on primary key of table?  ("Brian Tarbox" <btarbox@theworld.com>)
Responses Re: why Sequencial Scan when selecting on primary key of table?  ("Brian Tarbox" <btarbox@theworld.com>)
Re: why Sequencial Scan when selecting on primary key of table?  (Rod Taylor <rbt@rbt.ca>)
List pgsql-performance
"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

pgsql-performance by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: why Sequencial Scan when selecting on primary key of table?
Next
From: "Brian Tarbox"
Date:
Subject: Re: why Sequencial Scan when selecting on primary key of table?