Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 8E5371337B4E for ; Tue, 1 Mar 2011 13:34:06 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 54111-02 for ; Tue, 1 Mar 2011 17:33:59 +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 D5B7D1336971 for ; Tue, 1 Mar 2011 13:33:58 -0400 (AST) 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 p21HXsc2022076; Tue, 1 Mar 2011 12:33:55 -0500 (EST) To: Marc Cousin , Heikki Linnakangas , pgsql-performance@postgresql.org Subject: Re: inheritance: planning time vs children number vs column number In-reply-to: <17604.1298993631@sss.pgh.pa.us> References: <201102281038.04945.cousinmarc@gmail.com> <201102281947.46590.cousinmarc@gmail.com> <4188.1298960419@sss.pgh.pa.us> <201103010842.42128.cousinmarc@gmail.com> <17604.1298993631@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Tue, 01 Mar 2011 10:33:51 -0500" Date: Tue, 01 Mar 2011 12:33:54 -0500 Message-ID: <22075.1299000834@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201103/13 X-Sequence-Number: 42692 I wrote: > Marc Cousin writes: >> Yes, for the same test case, with a bit of data in every partition and >> statistics up to date, planning time goes from 20 seconds to 125ms for the 600 >> children/1000 columns case. Which is of course more than acceptable. > [ scratches head ... ] Actually, I was expecting the runtime to go up > not down. Maybe there's something else strange going on here. Oh, doh: the failing pg_statistic lookups are all coming from the part of estimate_rel_size() where it tries to induce a reasonable tuple width estimate for an empty table (see get_rel_data_width). Probably not a case we need to get really tense about. Of course, you could also argue that this code is stupid because it's very unlikely that there will be any pg_statistic entries either. Maybe we should just have it go directly to the datatype-based estimate instead of making a boatload of useless pg_statistic probes. regards, tom lane