Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U90GB-0002pH-Vh for pgsql-performance@arkaria.postgresql.org; Fri, 22 Feb 2013 21:34:28 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1U90GB-0008TX-Co for pgsql-performance@arkaria.postgresql.org; Fri, 22 Feb 2013 21:34:27 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U90GA-0008TS-AI for pgsql-performance@postgresql.org; Fri, 22 Feb 2013 21:34:26 +0000 Received: from mail-lb0-f171.google.com ([209.85.217.171]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1U90G8-0008KM-Fu for pgsql-performance@postgresql.org; Fri, 22 Feb 2013 21:34:25 +0000 Received: by mail-lb0-f171.google.com with SMTP id gg13so898620lbb.16 for ; Fri, 22 Feb 2013 13:34:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:date:from:to:cc:message-id:in-reply-to:references :subject:x-mailer:mime-version:content-type :content-transfer-encoding:content-disposition; bh=kcAp+SO4Ovife+t57uzlDkENmYmrlQR/I1W28mdJ05Q=; b=P6qXOifpBFthz8nV1P4IVFM8mn9+0Mn/6E5XxEuBFIhHLI8u5vwsCCgR8Aki/tC/4g 6xTfwVq6KxDGDD+LZRGj3Ly/bwaG2YXKt42dFlZfFEL//eQXZQjTfOkJ9GVLijYbQxTn 8RYub0hPpmHfqSK4v+dltni/abiVwLpgf3DV7FgtVkfFdZ4MEpRnLP0ya7ojqkGV6FUU A2MU/qgUhAjzhF13+rSTKnBtymLilkdJVKBMn0LQF5L57ORVZaQAZ/41xwR0BwF76ABO KXMZ5NHf4MR+Ly2qlFiGgBQsT/DYqcQ3cwzLobSISd68/04758ZaIr9HEUZmgDZLRVww WvFA== X-Received: by 10.112.28.169 with SMTP id c9mr1534542lbh.84.1361568863219; Fri, 22 Feb 2013 13:34:23 -0800 (PST) Received: from [10.0.1.14] ([217.14.6.25]) by mx.google.com with ESMTPS id t17sm1984645lam.9.2013.02.22.13.34.22 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 22 Feb 2013 13:34:22 -0800 (PST) Date: Fri, 22 Feb 2013 22:34:21 +0100 From: Alexander Staubo To: Kevin Grittner Cc: "=?utf-8?Q?pgsql-performance=40postgresql.org?=" Message-ID: In-Reply-To: <1361566076.10158.YahooMailNeo@web162905.mail.bf1.yahoo.com> References: <19B2B4ECC4724A438200C54257BA8B20@gmail.com> <1361566076.10158.YahooMailNeo@web162905.mail.bf1.yahoo.com> Subject: Re: Bad query plan with high-cardinality column X-Mailer: sparrow 1.6.4 (build 1178) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On Friday, February 22, 2013 at 21:47 , Kevin Grittner wrote: > I suspect you would be better off without those two indexes, and > instead having an index on (conversation_id, created_at). Not just > for the query you show, but in general. Indeed, that solved it, thanks! > In my experience these problems come largely from the planner not > knowing the cost of dealing with each tuple. I see a lot less of > this if I raise cpu_tuple_cost to something in the 0.03 to 0.05 > range. Is this something I can just frob a bit without worrying about it adversely impacting database performance across the board, or should I be very careful and do lots of testing on a staging box first? -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance