X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 731B6D1B511 for ; Wed, 22 Oct 2003 16:24:35 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 44110-04 for ; Wed, 22 Oct 2003 13:24:04 -0300 (ADT) Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id 84A3DD1B538 for ; Wed, 22 Oct 2003 13:24:03 -0300 (ADT) Received: from [63.195.55.98] (HELO spooky) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3806582; Wed, 22 Oct 2003 09:24:41 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Organization: Aglio Database Solutions To: "Medora Schauer" , "postgresql" Subject: Re: slow select Date: Wed, 22 Oct 2003 09:23:15 -0700 User-Agent: KMail/1.4.3 References: <906E2C446A276048A1BE283F17BCB12CDB40E6@encounter.fairind.fairfield.com> In-Reply-To: <906E2C446A276048A1BE283F17BCB12CDB40E6@encounter.fairind.fairfield.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <200310220923.15932.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/577 X-Sequence-Number: 4325 Medora, > I'm using pg 7.3.4 to do a select involving a join on 2 tables. > The query is taking 15 secs which seems extreme to me considering > the indices that exist on the two tables. EXPLAIN ANALYZE shows > that the indices aren't being used. I've done VACUUM ANALYZE on the > db with no change in results. Shouldn't the indices be used? No. You're selecting 100,000 records. For such a large record dump, a seq scan is usually faster. If you don't believe me, try setting enable_seqscan=false and see how long the query takes. -- Josh Berkus Aglio Database Solutions San Francisco