Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 24F531337B55 for ; Tue, 12 Oct 2010 11:49:57 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 69791-05 for ; Tue, 12 Oct 2010 14:49:47 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp02.lnh.mail.rcn.net (smtp02.lnh.mail.rcn.net [207.172.157.102]) by mail.postgresql.org (Postfix) with ESMTP id B297D1336473 for ; Tue, 12 Oct 2010 11:49:44 -0300 (ADT) Received: from ms14.lnh.mail.rcn.net ([208.58.56.82]) by smtp02.lnh.mail.rcn.net with ESMTP; 12 Oct 2010 10:49:45 -0400 Received: (from ms14.lnh.mail.rcn.net [69.182.178.231]) by ms14.lnh.mail.rcn.net (MOS 4.1.9-GA) with HTTP/1.1 id AND07357 (AUTH gnuoytr@rcn.com); Tue, 12 Oct 2010 10:49:44 -0400 (EDT) From: Subject: Re: How does PG know if data is in memory? To: pgsql-performance@postgresql.org X-Mailer: Mirapoint Webmail Direct 4.1.9-GA MIME-Version: 1.0 In-Reply-To: <4CB42BFC0200002500036805@gw.wicourts.gov> References: <4CA9488C.2080502@2ndquadrant.com> <4CAA5974.2050805@wizmail.org> <20101011231134.ANB76937@ms14.lnh.mail.rcn.net> <4CB42BFC0200002500036805@gw.wicourts.gov> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20101012104944.AND07357@ms14.lnh.mail.rcn.net> Date: Tue, 12 Oct 2010 10:49:44 -0400 (EDT) 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/152 X-Sequence-Number: 40571 Couldn't have said it better myself; covered all the bases. If PG wants to become an industrial strength database, worthy of replacing DB2/etc., then these are the sorts of knobs and switches it will need. -- None of that is anything for amateurs to play with. Not jam a stick in anybody's eye, but shouldn't database pros not be amateurs? Or are most PG-ers coders who don't really want to design and tune a database? Robert ---- Original message ---- >Date: Tue, 12 Oct 2010 09:35:56 -0500 >From: pgsql-performance-owner@postgresql.org (on behalf of "Kevin Grittner" ) >Subject: Re: [PERFORM] How does PG know if data is in memory? >To: , > > wrote: > >> An approach that works can be found in DB2, and likely elsewhere. >> >> The key is that tablespaces/tables/indexes/buffers are all >> attached through the bufferpool (the DB2 term). A tablespace/ >> bufferpool match is defined. Then tables and indexes are assigned >> to the tablespace (and implicitly, the bufferpool). As a result, >> one can effectively pin data in memory. This is very useful, but >> not low hanging fruit to implement. > >This sounds similar to Sybase named caches. You can segment off >portions of the memory for specific caches, break that up into space >reserved for different I/O buffer sizes, and bind specific database >objects (tables and indexes) to specific caches. On the few >occasions where someone had failed to configure the named caches >when setting up a machine, it was caught almost immediately after >deployment because of end-user complaints about poor performance. >This was so critical to performance for us when we were using >Sybase, that one of my first reactions on finding it missing in >PostgreSQL was distress over the inability to tune as I had. > >When I posted to the list about it, the response was that LRU >eviction was superior to any tuning any human would do. I didn't >and don't believe that, but have found it's close enough in the >PostgreSQL environment to be *way* down my list of performance >issues. In fact, when looking at the marginal benefits it would >generate in PostgreSQL when done right, versus the number of people >who would shoot themselves in the foot with it, even I have come >around to feeling it's probably not a good idea. > >FWIW, the four main reasons for using it were: > >(1) Heavily used data could be kept fully cached in RAM and not >driven out by transient activity. > >(2) You could flag a cache used for (1) above as using "relaxed LRU >accounting" -- it saved a lot of time tracking repeated references, >leaving more CPU for other purposes. > >(3) Each named cache had its own separate set of locks, reducing >contention. > >(4) Large tables for which the heap was often were scanned in its >entirety or for a range on the clustered index could be put in a >relatively small cache with large I/O buffers. This avoided blowing >out the default cache space for situations which almost always >required disk I/O anyway. > >None of that is anything for amateurs to play with. You need to set >up caches like that based on evidence from monitoring and do careful >benchmarking of the results to actually achieve improvements over >LRU logic. > >> The introduction of rudimentary tablespaces is a first step. I >> assumed that the point was to get to a DB2-like structure at some >> point. Yes? > >As far as I can tell, there is nobody with that intent. > >-Kevin > >-- >Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) >To make changes to your subscription: >http://www.postgresql.org/mailpref/pgsql-performance