Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id D05D3B5DBF7 for ; Mon, 16 May 2011 01:42:11 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 94576-06 for ; Mon, 16 May 2011 04:42:05 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from shrek.krogh.cc (2605ds1-ynoe.0.fullrate.dk [90.184.12.24]) by mail.postgresql.org (Postfix) with ESMTP id 7CD57B5DBD8 for ; Mon, 16 May 2011 01:42:03 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by shrek.krogh.cc (Postfix) with ESMTP id 327441D290D; Mon, 16 May 2011 06:42:02 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at shrek.krogh.cc Received: from shrek.krogh.cc ([127.0.0.1]) by localhost (shrek.krogh.cc [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id apHjkm8BFnyx; Mon, 16 May 2011 06:41:59 +0200 (CEST) Received: from [90.184.13.151] (2605ds1-ynoe.2.fullrate.dk [90.184.13.151]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: jesper@krogh.cc) by shrek.krogh.cc (Postfix) with ESMTPSA id 273D81D280C; Mon, 16 May 2011 06:41:59 +0200 (CEST) Message-ID: <4DD0AB16.5060808@krogh.cc> Date: Mon, 16 May 2011 06:41:58 +0200 From: Jesper Krogh User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 MIME-Version: 1.0 To: Greg Smith CC: Craig Ringer , =?ISO-8859-1?Q?C=E9dric_?= =?ISO-8859-1?Q?Villemain?= , Josh Berkus , pgsql-performance@postgresql.org Subject: Re: reducing random_page_cost from 4 to 2 to force index scan References: <4DB6F4BB020000250003CEB9@gw.wicourts.gov> <2823.1305314437@sss.pgh.pa.us> <4DCD90F5.2010501@agliodbs.com> <4DD0195A.9040305@agliodbs.com> <4DD07855.8080907@postnewspapers.com.au> <4DD07B4E.1020503@2ndquadrant.com> In-Reply-To: <4DD07B4E.1020503@2ndquadrant.com> Content-Type: multipart/alternative; boundary="------------080203040905070308090406" 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, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201105/232 X-Sequence-Number: 43741 This is a multi-part message in MIME format. --------------080203040905070308090406 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 2011-05-16 03:18, Greg Smith wrote: > You can't do it in real-time. You don't necessarily want that to > even if it were possible; too many possibilities for nasty feedback > loops where you always favor using some marginal index that happens > to be in memory, and therefore never page in things that would be > faster once they're read. The only reasonable implementation that > avoids completely unstable plans is to scan this data periodically > and save some statistics on it--the way ANALYZE does--and then have > that turn into a planner input. Would that be feasible? Have process collecting the data every now-and-then probably picking some conservative-average function and feeding it into pg_stats for each index/relation? To me it seems like a robust and fairly trivial way to to get better numbers. The fear is that the OS-cache is too much in flux to get any stable numbers out of it. -- Jesper --------------080203040905070308090406 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 2011-05-16 03:18, Greg Smith wrote:
> You can't do it in real-time. You don't necessarily want that to
> even if it were possible; too many possibilities for nasty feedback
> loops where you always favor using some marginal index that happens
> to be in memory, and therefore never page in things that would be
> faster once they're read. The only reasonable implementation that
> avoids completely unstable plans is to scan this data periodically
> and save some statistics on it--the way ANALYZE does--and then have
> that turn into a planner input.

Would that be feasible? Have process collecting the data every now-and-then
probably picking some conservative-average function and feeding
it into pg_stats for each index/relation?

To me it seems like a robust and fairly trivial way to to get better numbers. The
fear is that the OS-cache is too much in flux to get any stable numbers out
of it. 

--
Jesper


--------------080203040905070308090406--