Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 242259FCB98 for ; Thu, 8 Nov 2007 20:15:16 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 05554-06 for ; Thu, 8 Nov 2007 20:15:12 -0400 (AST) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id CEE479FCB95 for ; Thu, 8 Nov 2007 20:15:10 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id lA90F5XN025000; Thu, 8 Nov 2007 19:15:05 -0500 (EST) To: "Steinar H. Gunderson" cc: Pepe Barbe , pgsql-performance@postgresql.org Subject: Re: Join performance In-reply-to: <20071108225120.GA22963@uio.no> References: <2ACEBABD-7853-475B-B8C0-91B654AF143D@gmail.com> <20071108225120.GA22963@uio.no> Comments: In-reply-to "Steinar H. Gunderson" message dated "Thu, 08 Nov 2007 23:51:20 +0100" Date: Thu, 08 Nov 2007 19:15:04 -0500 Message-ID: <24997.1194567304@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200711/119 X-Sequence-Number: 27534 "Steinar H. Gunderson" writes: > On Thu, Nov 08, 2007 at 04:47:09PM -0600, Pepe Barbe wrote: >> I am having an issue on PostgreSQL 8.0.12. In the past we had performance >> issues with the query planner for queries on some tables where we knew we >> had indexes and it was doing a sequential scan, and for this reason we >> issue "SET enable_seqscan = FALSE" for some queries. > This is a bad idea in general. Indeed. A less brute-force way of getting the planner to favor indexscans is to reduce random_page_cost ... have you experimented with that? Also, consider updating to 8.2.x, which has an improved cost model for indexscans and will more often make the correct choice without such shenanigans. regards, tom lane