Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WkJlQ-0007ns-5B for pgsql-performance@arkaria.postgresql.org; Tue, 13 May 2014 20:57:28 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WkJlP-00050K-G9 for pgsql-performance@arkaria.postgresql.org; Tue, 13 May 2014 20:57:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WkJlO-00050D-JP for pgsql-performance@postgresql.org; Tue, 13 May 2014 20:57:26 +0000 Received: from mail-wi0-x236.google.com ([2a00:1450:400c:c05::236]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WkJlI-0005LO-2G for pgsql-performance@postgresql.org; Tue, 13 May 2014 20:57:26 +0000 Received: by mail-wi0-f182.google.com with SMTP id r20so1331820wiv.9 for ; Tue, 13 May 2014 13:57:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=user-agent:date:subject:from:to:cc:message-id:thread-topic :references:in-reply-to:mime-version:content-type; bh=8ofAyN0yszF7LbVO2dqzlpe684GsiOuMMoZ0oiuc9TQ=; b=uAUyBbtMHkqKU20QY2578Bp8UEMaBsXuJC0EaNY7f1kxNwEw937O8ZmU7im4oduQeX kkG/iyrneCj0TR2qQcNNRcrr5ldSt+1ZMoiLoPQPGyiCChBe8PsaFEy9WUehelAaZjvJ 4eq730Icgam7WXYhNvei06D8oCTI1LP6C4fYeOXt4hZxOJbe/Z0qOgHW5wvFb11xGBi9 FCjtrVCcHKKJwtDlVCGIgHtRau1RFVsRNjAhlpHBuViZW7bSnMeG1jqdafGHwHBCFO7v fhXKY3oNF4EaiL0oB2A+y6sv2TQEmADXzfoHnpZlsI7ZrFF6k3XpRiJonn6+xZEq02vM kDgg== X-Received: by 10.180.206.36 with SMTP id ll4mr29914wic.57.1400014639114; Tue, 13 May 2014 13:57:19 -0700 (PDT) Received: from [192.168.0.28] (cpc14-dals19-2-0-cust193.20-2.cable.virginm.net. [62.31.88.194]) by mx.google.com with ESMTPSA id p18sm23862679wik.3.2014.05.13.13.57.16 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 13 May 2014 13:57:17 -0700 (PDT) User-Agent: Microsoft-MacOutlook/14.4.1.140326 Date: Tue, 13 May 2014 21:57:10 +0100 Subject: Re: Constraint exclusion won't exclude parent table From: Tim Kane To: Tom Lane CC: "pgsql-performance@postgresql.org" Message-ID: Thread-Topic: [PERFORM] Constraint exclusion won't exclude parent table References: <27718.1400012679@sss.pgh.pa.us> In-Reply-To: <27718.1400012679@sss.pgh.pa.us> Mime-version: 1.0 Content-type: multipart/alternative; boundary="B_3482863037_69816747" X-Pg-Spam-Score: -2.0 (--) 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 > This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. --B_3482863037_69816747 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: quoted-printable >=20 >=20 > Yeah, it's not expected that that's going to cost much. I am suspicious > that what you are looking at is mostly measurement overhead: during > EXPLAIN ANALYZE, each plan node has to do two gettimeofday() calls per > call, and there are lots of platforms where that is significant relative > to the actual work done per node. >=20 > You might try comparing the overall times for select count(*) from ... > rather than EXPLAIN ANALYZE for these two cases. If those times are > much closer together than what you're getting from EXPLAIN ANALYZE, > then you've got a machine with expensive gettimeofday() and you have > to take your measurements with an appropriate quantum of salt. >=20 > regards, tom lane Interesting..=20 Direct query: Time: 374336.514 ms Indirect query: Time: 387114.059 ms Mystery solved. Thanks again Tom. For what it=E2=80=99s worth: Linux 3.2.0-4-amd64 Debian 3.2.46-1+deb7u1 x86_64 >=20 --B_3482863037_69816747 Content-type: text/html; charset="UTF-8" Content-transfer-encoding: quoted-printable


Yeah, it's not expected that that's going = to cost much.  I am suspicious
that what you are looking= at is mostly measurement overhead: during
EXPLAIN ANALYZE, each p= lan node has to do two gettimeofday() calls per
call, and there ar= e lots of platforms where that is significant relative
to the actu= al work done per node.

You might try comparing the = overall times for select count(*) from ...
rather than EXPLAIN ANA= LYZE for these two cases.  If those times are
much close= r together than what you're getting from EXPLAIN ANALYZE,
then you= 've got a machine with expensive gettimeofday() and you have
to ta= ke your measurements with an appropriate quantum of salt.

regards, tom lane

Interesting.. 

Direct query:
Time: 374336.514 ms

I= ndirect query:
Time: 387114.059 ms

Myster= y solved. Thanks again Tom.

For what it’s wor= th: Linux 3.2.0-4-amd64  Debian 3.2.46-1+deb7u1 x86_64

--B_3482863037_69816747--