Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 142111337B3E for ; Mon, 4 Oct 2010 00:29:15 -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 94775-04 for ; Mon, 4 Oct 2010 03:29:07 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.10]) by mail.postgresql.org (Postfix) with ESMTP id 60FEC1336473 for ; Mon, 4 Oct 2010 00:29:07 -0300 (ADT) Received: from [192.168.1.6] (static-71-179-240-8.bltmmd.fios.verizon.net [71.179.240.8]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0LaacB-1OJx8B2MMJ-00m9Uq; Mon, 04 Oct 2010 05:29:05 +0200 Message-ID: <4CA949FF.4000200@2ndquadrant.com> Date: Sun, 03 Oct 2010 23:29:03 -0400 From: Greg Smith User-Agent: Thunderbird 2.0.0.24 (X11/20100317) MIME-Version: 1.0 To: Craig Ringer CC: =?ISO-8859-1?Q?Fabr=EDcio_dos_Anjos_Silva?= , pgsql-performance@postgresql.org Subject: Re: How does PG know if data is in memory? References: <4CA5D2F5.5070900@postnewspapers.com.au> In-Reply-To: <4CA5D2F5.5070900@postnewspapers.com.au> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:GfQjk4zdfir/vHOWS4q+bHQHuI69urtBGl1jhxlrv4E tRlHVXUfIX523K5oBqNmJ4iZW/k0VYTiShLhPPju2YW9XKvdAO Dg1QsPG2rXK8lu/RbeKI5ugj+4qOnY10NXGHVQ/GAchckzqWQm fenG/Sc7ytxbfFaAJsZ2ADCqfs/i+mOLgMNE9U+RccEuB9GB5D CrUn/Mm4/UvDie8XevNBZYGXFVCiMGmPlzArItRmm0= 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, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201010/21 X-Sequence-Number: 40440 Craig Ringer wrote: > If some kind of cache awareness was to be added, I'd be interested in > seeing a "hotness" measure that tracked how heavily a given > relation/index has been accessed and how much has been read from it > recently. A sort of age-scaled blocks-per-second measure that includes > both cached and uncached (disk) reads. This would let the planner know > how likely parts of a given index/relation are to be cached in memory > without imposing the cost of tracking the cache in detail. I'm still > not sure it'd be all that useful, though... Yup, that's one of the design ideas scribbled in my notes, as is the idea of what someone dubbed a "heat map" that tracked which parts of the relation where actually the ones in RAM, the other issue you mentioned. The problem facing a lot of development possibilities in this area is that we don't have any continuous benchmarking of complicated plans going on right now. So if something really innovative is done, there's really no automatic way to test the result and then see what types of plans it improves and what it makes worse. Until there's some better performance regression work like that around, development on the optimizer has to favor being very conservative. -- Greg Smith, 2ndQuadrant US greg@2ndQuadrant.com Baltimore, MD PostgreSQL Training, Services and Support www.2ndQuadrant.us Author, "PostgreSQL 9.0 High Performance" Pre-ordering at: https://www.packtpub.com/postgresql-9-0-high-performance/book