pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rod Taylor <rbt@rbt.ca>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Brian Tarbox <btarbox@theworld.com>
Cc: Postgresql Performance <pgsql-performance@postgresql.org>
Subject: Re: why Sequencial Scan when selecting on primary key of table?
Date: 31 May 2003 13:51:11 -0400
Message-ID: <1054403470.11968.34.camel@jester> (raw)
In-Reply-To: <21073.1054401227@sss.pgh.pa.us>
References: <004301c32791$f983c710$01000001@trouble>
	<21073.1054401227@sss.pgh.pa.us>

On Sat, 2003-05-31 at 13:13, Tom Lane wrote:
> "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.

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@rbt.ca>

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

Attachments:

  signature.asc (application/pgp-signature, 186B) download

view thread (8+ messages)  latest in thread

Message-ID: <1054403470.11968.34.camel@jester>
Permalink:  ../1054403470.11968.34.camel@jester/
Also on:    postgresql.org/message-id/1054403470.11968.34.camel@jester

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: rbt@rbt.ca, tgl@sss.pgh.pa.us, btarbox@theworld.com
  Subject: Re: why Sequencial Scan when selecting on primary key of table?
  In-Reply-To: <1054403470.11968.34.camel@jester>
  References: <004301c32791$f983c710$01000001@trouble> <21073.1054401227@sss.pgh.pa.us> <1054403470.11968.34.camel@jester>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox