pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Brian Tarbox <btarbox@theworld.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org
Subject: Re: why Sequencial Scan when selecting on primary key of table?
Date: Sat, 31 May 2003 13:45:50 -0400
Message-ID: <000001c3279c$79dc2d80$01000001@trouble> (raw)
In-Reply-To: <21073.1054401227@sss.pgh.pa.us>

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




view thread (8+ messages)  latest in thread

Message-ID: <000001c3279c$79dc2d80$01000001@trouble>
Permalink:  ../000001c3279c$79dc2d80$01000001@trouble/
Also on:    postgresql.org/message-id/000001c3279c$79dc2d80$01000001@trouble

 · 

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: btarbox@theworld.com, tgl@sss.pgh.pa.us
  Subject: Re: why Sequencial Scan when selecting on primary key of table?
  In-Reply-To: <000001c3279c$79dc2d80$01000001@trouble>
  References: <21073.1054401227@sss.pgh.pa.us> <000001c3279c$79dc2d80$01000001@trouble>

* 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