X-Original-To: pgsql-performance@postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id 1BD39926028 for ; Sat, 31 May 2003 13:51:20 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 11175-07 for ; Sat, 31 May 2003 13:51:09 -0400 (EDT) Received: from simmts2-srv.bellnexxia.net (simmts2.bellnexxia.net [206.47.199.11]) by developer.postgresql.org (Postfix) with ESMTP id 30889926020 for ; Sat, 31 May 2003 13:51:09 -0400 (EDT) Received: from [192.168.1.200] ([64.231.215.231]) by simmts2-srv.bellnexxia.net (InterMail vM.5.01.05.32 201-253-122-126-132-20030307) with ESMTP id <20030531175107.PKFC26980.simmts2-srv.bellnexxia.net@[192.168.1.200]>; Sat, 31 May 2003 13:51:07 -0400 Subject: Re: why Sequencial Scan when selecting on primary key of table? From: Rod Taylor To: Tom Lane Cc: Brian Tarbox , Postgresql Performance In-Reply-To: <21073.1054401227@sss.pgh.pa.us> References: <004301c32791$f983c710$01000001@trouble> <21073.1054401227@sss.pgh.pa.us> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-KM+mrr7aYKiWLenALY1p" Organization: Message-Id: <1054403470.11968.34.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 31 May 2003 13:51:11 -0400 X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/301 X-Sequence-Number: 2080 --=-KM+mrr7aYKiWLenALY1p Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Sat, 2003-05-31 at 13:13, Tom Lane wrote: > "Brian Tarbox" writes: > > When I say "explain select * from Patient where Patient_primary_key =3D= 100" > > I get sequential scan. >=20 > 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? --=20 Rod Taylor PGP Key: http://www.rbt.ca/rbtpub.asc --=-KM+mrr7aYKiWLenALY1p Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQA+2OuO6DETLow6vwwRAkOnAKCFHPr4ikuBchuPZHEMogTroKkz+wCbBTxK KWliKG4CQkAjbOePbRpo85s= =TFCz -----END PGP SIGNATURE----- --=-KM+mrr7aYKiWLenALY1p--