Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id D6D4564FD00 for ; Thu, 7 Aug 2008 00:16:45 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 79744-03-4 for ; Thu, 7 Aug 2008 00:16:32 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.156]) by postgresql.org (Postfix) with ESMTP id 8D7EB6501B8 for ; Thu, 7 Aug 2008 00:14:18 -0300 (ADT) Received: by fg-out-1718.google.com with SMTP id 16so199348fgg.23 for ; Wed, 06 Aug 2008 20:14:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=SqV5G6/SoToix2w05mJ1VjtAWRi9GPxNeS1cM9Rr9R0=; b=Yn14vNCc5KPO+ZLr0lBCgsx70NOYKMYtn1I7bEErEf796mCB25Y5ftiQgUO2jyPd+3 RBBInwDLCR2QuIUAXR1Ek0EH6GKKf7AMidk6zi260RB+Tjb5ue7XBMm4JIJDwPEbc1Se g8l7gUyDQqMQivz7DojQNNY+CgUNccPogUj+M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=dPV2SrZ4NpGIBva9jjSghbQsY3xjFhoy0KI1jk+r70ecVPTEBgAs/wh1u7/Xu7SVg8 H6oY+qwvPa+9IyzdqjqLmAhDVzhlAuV1vZt5jedPB08NoC6GVsQlnb7ti3O+zZRN/0Qy p8cCAmt+55AshA0iZAX1Xmi8vC9H4HzSIrIHk= Received: by 10.86.29.19 with SMTP id c19mr1335767fgc.28.1218078857811; Wed, 06 Aug 2008 20:14:17 -0700 (PDT) Received: by 10.86.2.11 with HTTP; Wed, 6 Aug 2008 20:14:17 -0700 (PDT) Message-ID: <84f0acdb0808062014p29cf7482ied332225a0a92c63@mail.gmail.com> Date: Wed, 6 Aug 2008 22:14:17 -0500 From: "Joshua Shanks" To: "Craig Ringer" Subject: Re: query planner not using the correct index Cc: pgsql-performance@postgresql.org In-Reply-To: <489A623A.4090400@postnewspapers.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <84f0acdb0808061435q5ebb607cjc311f1eb4da841a@mail.gmail.com> <489A623A.4090400@postnewspapers.com.au> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200808/24 X-Sequence-Number: 30905 > - Have you changed the random page cost on either installation? This is whatever the default is for both boxes (commented config file says 4.0) > - Have both installations had VACUUM ANALYZE run recently? This is the first thing I did and didn't seem to do anything. Oddly enough I just went and did a VACUUM ANALYZE on a newly restored db on the test server and get the same query plan as production so I am now guessing something with the stats from ANALYZE are making postgres think the string index is the best bet but is clearly 1000's of times slower. > - Are the stats targets the same on both installations? If you mean default_statistics_target that is also the default (commented config file says 10) > - Do both installations have similar shared buffers, total available RAM info, etc? The boxes have different configs as the test box isn't as big as the production on so it doesn't have as much resources available or allocated to it. I did run the query on the backup db box (exact same hardware and configuration as the production box) which gets restored from a backup periodically (how I populated the test db) and got the same results as the test box.