Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 84D2EB5DD04 for ; Fri, 15 Jul 2011 14:59:23 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 28813-03-2 for ; Fri, 15 Jul 2011 17:59:17 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 00B02B5DC1E for ; Fri, 15 Jul 2011 14:58:51 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p6FHwnjF004224; Fri, 15 Jul 2011 13:58:49 -0400 (EDT) To: Svetlin Manavski cc: pgsql-performance@postgresql.org Subject: Re: Unexpected seq scans when expected result is 1 row out of milions In-reply-to: References: Comments: In-reply-to Svetlin Manavski message dated "Fri, 15 Jul 2011 13:57:18 +0100" Date: Fri, 15 Jul 2011 13:58:49 -0400 Message-ID: <4223.1310752729@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=0.001 X-Spam-Level: X-Archive-Number: 201107/159 X-Sequence-Number: 44371 Svetlin Manavski writes: > The question is: why do we get a seq scan on appqosdata.tcpsessiondata_1 and > appqosdata.tcpsessiondata_2 even if the planner estimates correctly 1 row > out of millions could potentially be selected? As you can see ~90% of the > time is spent on those 2 partitions even if they are not apparently > different from any of the others. Well, there must be *something* different about them. Are you sure they've got the same indexes as the others? It would be useful to see psql's \d report for those partitions, as well as for one of the partitions that's behaving as expected. You might also compare the EXPLAIN results for doing the query on just one child table between the normal and misbehaving partitions. regards, tom lane