Skip site navigation (1) Skip section navigation (2)

Re: why Sequencial Scan when selecting on primary key of table?

From: Rod Taylor <rbt(at)rbt(dot)ca>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Brian Tarbox <btarbox(at)theworld(dot)com>,Postgresql Performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: why Sequencial Scan when selecting on primary key of table?
Date: 2003-05-31 17:51:11
Message-ID: 1054403470.11968.34.camel@jester (view raw or flat)
Thread:
Lists: pgsql-performance
On Sat, 2003-05-31 at 13:13, Tom Lane wrote:
> "Brian Tarbox" <btarbox(at)theworld(dot)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.

Out of curiosity, why don't we confirm the unquoted value is an integer,
numeric, etc, then change it into type 'unknown'?  From that point
forward it would be treated like it's quoted counterpart.

Is this noticeably slower or am I missing something?

-- 
Rod Taylor <rbt(at)rbt(dot)ca>

PGP Key: http://www.rbt.ca/rbtpub.asc

In response to

Responses

pgsql-performance by date

Next:From: Tom LaneDate: 2003-05-31 17:55:01
Subject: Re: why Sequencial Scan when selecting on primary key of table?
Previous:From: Brian TarboxDate: 2003-05-31 17:45:50
Subject: Re: why Sequencial Scan when selecting on primary key of table?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group