X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 32A42D1C47A for ; Mon, 11 Aug 2003 22:05:19 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 44393-06 for ; Mon, 11 Aug 2003 19:03:48 -0300 (ADT) Received: from davinci.ethosmedia.com (unknown [209.128.84.228]) by svr1.postgresql.org (Postfix) with ESMTP id B0A67D1C4DF for ; Mon, 11 Aug 2003 19:05:05 -0300 (ADT) Received: from [66.219.92.2] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 3503125 for pgsql-performance@postgresql.org; Mon, 11 Aug 2003 15:05:31 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: Odd problem with performance in duplicate database Date: Mon, 11 Aug 2003 15:03:46 -0700 User-Agent: KMail/1.4.3 References: <200308111415.07751.josh@agliodbs.com> In-Reply-To: <200308111415.07751.josh@agliodbs.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200308111503.46794.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/175 X-Sequence-Number: 2992 Folks, More followup on this: The crucial difference between the two execution plans is this clause: test db has: -> Seq Scan on case_clients (cost=3D0.00..3673.48 rows=3D11274 width=3D11= ) (actual=20 time=3D0.02..302.20 rows=3D8822 loops=3D855) whereas live db has: -> Index Scan using idx_caseclients_case on case_clients (cost=3D0.00..5.= 10=20 rows=3D1 width=3D11) (actual time=3D0.03..0.04 rows=3D1 loops=3D471) using an enable_seqscan =3D false fixes this, but is obviously not a long-t= erm=20 solution.=20=20=20 I've re-created the test system from an immediate copy of the live database= ,=20 and checked that the the main tables and indexes were reproduced faithfully. Lowering random_page_cost seems to do the trick. But I'm still mystified; = why=20 would one identical database pick a different plan than its copy? --=20 -Josh Berkus Aglio Database Solutions San Francisco