Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c39a2-0002dL-BT for pgsql-performance@arkaria.postgresql.org; Sat, 05 Nov 2016 22:36:54 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1c39a1-0006dD-6N for pgsql-performance@arkaria.postgresql.org; Sat, 05 Nov 2016 22:36:53 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1c39Zy-0006cL-MU for pgsql-performance@postgresql.org; Sat, 05 Nov 2016 22:36:50 +0000 Received: from mail-it0-x229.google.com ([2607:f8b0:4001:c0b::229]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1c39Zq-0000jt-8s for pgsql-performance@postgresql.org; Sat, 05 Nov 2016 22:36:48 +0000 Received: by mail-it0-x229.google.com with SMTP id q124so49873199itd.1 for ; Sat, 05 Nov 2016 15:36:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=QM+ihI84AtgbphP+IYHLhYlm8z95R5aRs+qh4D0P0bM=; b=h5qOAf/OvcxDrQaPTn7TUmXcHAncMxmAIBZrx+Xd/vlKfrq0+ueTcNLLiFBW2mQY+5 XE3CQWiZ+JlP41q0l3LDJ3xXJuuj1SciHguMpkuCfsxcJD1b/OFQv1mt3+tmzIDXej8l +0du5byh77UNiVG9B4qrcqWPZfjsbQ40bHsG89LllL4vC8Q3ZubjdnYvDw+skIwPMHhh VxRo5pIALN8xJgUNcUPOi/Y3sgcAjB8v8Isb8ZPdKErnNX4n6E8iZS3fUlc9uzOoM2YA 5QGQ6yVsT1S5Q3klp1nvSdfg2bB9phCUmG0EkhYnx69SYoRSodPRscnc6E6tWWBLkunk eidg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=QM+ihI84AtgbphP+IYHLhYlm8z95R5aRs+qh4D0P0bM=; b=eliTlgHsBBApC/ESW0H8YUcEyk+AEpLG0/krL4cec+nqaZ0CqBJmBLczJMCRuY0DFA 3sgU1Uyd8nfnoRv0LX7+vC7X5HOtbEEVGlR2tamBmmOTut+szzAmJMY4L3xj+wjKbm1n t5WnZDks08gAHlL7mNPeR+UmjAiP7AJKofvMmYzepPEKkgstemsevYRKbWaXb0F5puJo MpF7oz/uEFHEzWeqSq9Vi9D0lFL/rc633TdS1UNT6gy3rpQvmItjdXxXH28Ku0TA+n2y YSxJxWDg3sj4nyQjKdeQ8X62XLQyW6FIeoHJLESVVmOPphCruAZ9s4opNMYsKSGEkfg9 x6vQ== X-Gm-Message-State: ABUngveu1ryIqEDnxigwzUXhhUh+MKHaKkdXcv0C44tWKMFndqexd7v92e9Ib/tZ3v++zw== X-Received: by 10.36.13.82 with SMTP id 79mr608931itx.22.1478385399949; Sat, 05 Nov 2016 15:36:39 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id u19sm7295579iou.31.2016.11.05.15.36.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 05 Nov 2016 15:36:39 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id 019D4801FF1; Sat, 5 Nov 2016 17:36:37 -0500 (CDT) Date: Sat, 5 Nov 2016 17:36:37 -0500 From: Justin Pryzby To: Tom Lane Cc: pgsql-performance@postgresql.org Subject: Re: no MCV list of tiny table with unique columns Message-ID: <20161105223637.GJ2139@telsasoft.com> References: <20161102185318.GA3987@telsasoft.com> <26162.1478117146@sss.pgh.pa.us> <20161102201955.GB2139@telsasoft.com> <27252.1478130503@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <27252.1478130503@sss.pgh.pa.us> User-Agent: Mutt/1.5.23 (2014-03-12) 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 Wed, Nov 02, 2016 at 07:48:23PM -0400, Tom Lane wrote: > There's not a lot of point in worrying about your two-row table when these > other estimates are off by multiple orders of magnitude. In this > particular case my first bet would be that the planner has no idea about > the selectivity of the conditions on "echo_tango('seven_november'::text, > four_charlie)". Reformulating that, or maybe making an index on it just > so that ANALYZE will gather stats about it, could help. Thanks, you're exactly right. That's date_trunc('hour') BTW. We actually already have a "new way" of doing that which avoids date_trunc, so now I just have to get it in place for 100+ old reports.. I thought I had tried that before, but I think I was confusing myself, and tried putting the index on the parent, which ends up with no stats since it's empty. With indices+analyze: Sort (cost=189014.28..189014.28 rows=1 width=785) (actual time=25063.831..25063.886 rows=328 loops=1) ... BTW: join_collapse_limit | 8 from_collapse_limit | 8 ..and changing them doesn't seem to have any effect. By my count there's 11 tables, not counting multiply a few used multiply.. Thanks again. Justin -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance