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 EFCF492602B for ; Sat, 31 May 2003 13:55:12 -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-10 for ; Sat, 31 May 2003 13:55:02 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by developer.postgresql.org (Postfix) with ESMTP id 21722926034 for ; Sat, 31 May 2003 13:55:02 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h4VHt1U6021290; Sat, 31 May 2003 13:55:01 -0400 (EDT) To: "Brian Tarbox" Cc: pgsql-performance@postgresql.org Subject: Re: why Sequencial Scan when selecting on primary key of table? In-reply-to: <000001c3279c$79dc2d80$01000001@trouble> References: <000001c3279c$79dc2d80$01000001@trouble> Comments: In-reply-to "Brian Tarbox" message dated "Sat, 31 May 2003 13:45:50 -0400" Date: Sat, 31 May 2003 13:55:01 -0400 Message-ID: <21289.1054403701@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/302 X-Sequence-Number: 2081 "Brian Tarbox" writes: > The primary key field is an integer and I have performed vacuum analyse but > that does not seem to change anything. Hm. So how big is the table, exactly? On small tables a seqscan will be preferred because the extra I/O to examine the index costs more than the CPU to examine all the tuples on a disk page. > I've also heard that postgres will not indexes when JOINing tables. Can > that really be true?? We have some join methods that like indexes and we have some that find no benefit in 'em. Again, testing on toy-size tables is not a good guide to what will happen on larger tables. regards, tom lane