X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 8A76C11F60E3 for ; Wed, 26 Apr 2006 19:25:13 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 34338-04 for ; Wed, 26 Apr 2006 19:25:00 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id CA48411F60AE for ; Wed, 26 Apr 2006 19:24:58 -0300 (ADT) Received: by noel.decibel.org (Postfix, from userid 1001) id 664CA56423; Wed, 26 Apr 2006 17:24:58 -0500 (CDT) Received: (hashcash-sendmail, from uid 1001); Wed, 26 Apr 2006 17:24:57 -0500 Date: Wed, 26 Apr 2006 17:24:57 -0500 From: "Jim C. Nasby" To: mark@mark.mielke.cc Cc: Ron Peacetree , Scott Marlowe , Bill Moran , pgsql-performance@postgresql.org Subject: Re: Large (8M) cache vs. dual-core CPUs Message-ID: <20060426222456.GB97354@pervasive.com> References: <8991088.1146020837420.JavaMail.root@elwamui-mouette.atl.sa.earthlink.net> <20060426064852.GA16879@mark.mielke.cc> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060426064852.GA16879@mark.mielke.cc> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060426:mark@mark.mielke.cc::PocIXakYwn2/oIkL:000000000000000000 0000000000000000000000000lev X-Hashcash: 1:20:060426:rjpeace@earthlink.net::e/OTybcsZ590A7H5:0000000000000000 0000000000000000000000005vpM X-Hashcash: 1:20:060426:smarlowe@g2switchworks.com::9a+Fcwr1NxLKRpI8:00000000000 0000000000000000000000002w2l X-Hashcash: 1:20:060426:wmoran@collaborativefusion.com::7L4tPA+plp0MqDXv:0000000 0000000000000000000000001WNH X-Hashcash: 1:20:060426:pgsql-performance@postgresql.org::jVr/D2s3JHH9aQOC:00000 0000000000000000000000002bSM X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200604/614 X-Sequence-Number: 18698 On Wed, Apr 26, 2006 at 02:48:53AM -0400, mark@mark.mielke.cc wrote: > You said that DB accesses are random. I'm not so sure. In PostgreSQL, > are not the individual pages often scanned sequentially, especially > because all records are variable length? You don't think PostgreSQL > will regularly read 32 bytes (8 bytes x 4) at a time, in sequence? > Whether for table pages, or index pages - I'm not seeing why the > accesses wouldn't be sequential. You believe PostgreSQL will access > the table pages and index pages randomly on a per-byte basis? What > is the minimum PostgreSQL record size again? Isn't it 32 bytes or > over? :-) Data within a page can absolutely be accessed randomly; it would be horribly inefficient to slog through 8K of data every time you needed to find a single row. The header size of tuples is ~23 bytes, depending on your version of PostgreSQL, and data fields have to start on the proper alignment (generally 4 bytes). So essentially the smallest row you can get is 28 bytes. I know that tuple headers are dealt with as a C structure, but I don't know if that means accessing any of the header costs the same as accessing the whole thing. I don't know if PostgreSQL can access fields within tuples without having to scan through at least the first part of preceeding fields, though I suspect that it can access fixed-width fields that sit before any varlena fields directly (without scanning through the other fields). If we ever got to the point of divorcing the in-memory tuple layout from the table layout it'd be interesting to experiment with having all varlena length info stored immediately after all fixed-width fields; that could potentially make accessing varlena's randomly faster. Note that null fields are indicated as such in the null bitmap, so I'm pretty sure that their in-tuple position doesn't matter much. Of course if you want the definitive answer, Use The Source. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461