Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 215F6B5DBD8 for ; Mon, 16 May 2011 01:49:33 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 95224-08 for ; Mon, 16 May 2011 04:49:26 +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 1BB5FB5DBD7 for ; Mon, 16 May 2011 01:49:26 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by shrek.krogh.cc (Postfix) with ESMTP id 3ED1B1D28B0 for ; Mon, 16 May 2011 06:49:24 +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 3KEPdAJCrDi7 for ; Mon, 16 May 2011 06:49:21 +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 44B4E1D280C for ; Mon, 16 May 2011 06:49:21 +0200 (CEST) Message-ID: <4DD0ACD0.1090801@krogh.cc> Date: Mon, 16 May 2011 06:49:20 +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: 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> <4DD0AB16.5060808@krogh.cc> In-Reply-To: <4DD0AB16.5060808@krogh.cc> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201105/233 X-Sequence-Number: 43742 On 2011-05-16 06:41, Jesper Krogh wrote: > 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. Ok, it may not work as well with index'es, since having 1% in cache may very well mean that 90% of all requested blocks are there.. for tables in should be more trivial. -- Jesper