From: | "Brian Tarbox" <btarbox(at)theworld(dot)com> |
---|---|
To: | "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: why Sequencial Scan when selecting on primary key of table? |
Date: | 2003-05-31 17:45:50 |
Message-ID: | 000001c3279c$79dc2d80$01000001@trouble |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
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(at)postgresql(dot)org
[mailto:pgsql-performance-owner(at)postgresql(dot)org]On Behalf Of Tom Lane
Sent: Saturday, May 31, 2003 1:14 PM
To: Brian Tarbox
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: [PERFORM] why Sequencial Scan when selecting on primary key
of table?
"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. (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?
From | Date | Subject | |
---|---|---|---|
Next Message | Rod Taylor | 2003-05-31 17:51:11 | Re: why Sequencial Scan when selecting on primary key of table? |
Previous Message | Tom Lane | 2003-05-31 17:13:47 | Re: why Sequencial Scan when selecting on primary key of table? |