Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TSuuH-0002Pq-7p for pgsql-performance@postgresql.org; Mon, 29 Oct 2012 19:21:53 +0000 Received: from mailout-us.gmx.com ([74.208.5.67]) by makus.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TSuuF-0004WG-Ii for pgsql-performance@postgresql.org; Mon, 29 Oct 2012 19:21:52 +0000 Received: (qmail 27295 invoked by uid 0); 29 Oct 2012 18:51:15 -0000 Received: from 76.255.19.161 by rms-us001 with HTTP Cc: pgsql-performance@postgresql.org Content-Type: text/plain; charset="utf-8" Date: Mon, 29 Oct 2012 14:51:14 -0400 From: "Kevin Grittner" Message-ID: <20121029185114.79490@gmx.com> MIME-Version: 1.0 Subject: Re: Setting Statistics on Functional Indexes To: sthomas@optionshouse.com,"Tom Lane" X-Authenticated: #138763884 X-Flags: 0001 X-Mailer: GMX.com Web Mailer x-registered: 0 Content-Transfer-Encoding: 8bit X-GMX-UID: dbX8cGl+3zOlOQ09Lnwh+I1+IGRvb4A3 X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201210/354 X-Sequence-Number: 48313 Shaun Thomas wrote: > I know that current_date seems like an edge case, but I can't see > how getting the most recent activity for something is an uncommon > activity. Tip tracking is actually the most frequent pattern in the > systems I've seen. Yeah, this has been a recurring problem with database statistics with various products for at least 20 years. For a while I was using a product whose optimizer engineers referred to it as "data skew" and recommended adding a "dummy" entry to get a single value out past the maximum end of the range. If you couldn't stomach the dummy data, they had detailed instructions for dumping your statistics, tinkering with the end of it to allow for the issue, and writing it back over the actual statistics gathered. We need a better answer than that. > I just wonder if this particular tweak isn't more of a regression > than initially thought. It does seem like we have a serious regression in terms of this particular issue. -Kevin