Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 66AFC9FB2F8 for ; Tue, 12 Jun 2007 15:43:30 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 14281-08 for ; Tue, 12 Jun 2007 15:43:26 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id C0AF29FB2A0 for ; Tue, 12 Jun 2007 15:43:26 -0300 (ADT) 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 l5CIgv6L021856; Tue, 12 Jun 2007 14:42:57 -0400 (EDT) To: Christo Du Preez cc: pgsql-performance@postgresql.org Subject: Re: test / live environment, major performance difference In-reply-to: <466EDD7C.5090807@mecola.com> References: <466EA078.20601@mecola.com> <8385.1181664586@sss.pgh.pa.us> <466ED0E4.3040803@mecola.com> <19136.1181669869@sss.pgh.pa.us> <466EDD7C.5090807@mecola.com> Comments: In-reply-to Christo Du Preez message dated "Tue, 12 Jun 2007 19:53:00 +0200" Date: Tue, 12 Jun 2007 14:42:57 -0400 Message-ID: <21855.1181673777@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200706/225 X-Sequence-Number: 25258 Christo Du Preez writes: > Fast: > "public";"layertype";"parentid";0.98797;4;2;"{4,1}";"{0.00902256,0.00300752}";"";-0.142857 > Slow: > "public";"layertype";"parentid";0.00745157;4;7;"{300}";"{0.976155}";"{1,1,4,5,8,12}";0.92262 Well, those statistics are almost completely different, and what the slow one says is that parentid = 300 accounts for 97% of the table. So that's why you get different plans. If that is not reflective of reality, then you have not ANALYZEd the table lately. Maybe it's a pilot-error problem, like not doing the ANALYZE as a user with sufficient privileges? IIRC you have to be table owner, database owner, or superuser to ANALYZE. regards, tom lane