X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id ECFE311F6C82 for ; Fri, 14 Apr 2006 03:14:21 -0300 (ADT) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Score: 0.388 X-Spam-Level: X-Spam-Status: No, score=0.388 required=5 tests=[AWL=0.388] Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id ISi+vI4yrBPW for ; Fri, 14 Apr 2006 03:14:18 -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 0CC8F11F6C7C for ; Fri, 14 Apr 2006 03:14:18 -0300 (ADT) Received: by noel.decibel.org (Postfix, from userid 1001) id 4D3FB56423; Fri, 14 Apr 2006 01:14:16 -0500 (CDT) Received: (hashcash-sendmail, from uid 1001); Fri, 14 Apr 2006 01:14:14 -0500 Date: Fri, 14 Apr 2006 01:14:14 -0500 From: "Jim C. Nasby" To: Tom Lane Cc: Postgresql Performance Subject: Re: Blocks read for index scans Message-ID: <20060414061414.GY49405@pervasive.com> References: <85979594-1CCA-43C5-A8F2-08685CF41ACE@pervasive.com> <2789.1144974969@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2789.1144974969@sss.pgh.pa.us> 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:060414:tgl@sss.pgh.pa.us::drmyBQfMNsGyjaPL:00000000000000000000 000000000000000000000000AP83 X-Hashcash: 1:20:060414:pgsql-performance@postgresql.org::eXHIb5jJR8mAhwuL:00000 0000000000000000000000008IFg X-Archive-Number: 200604/323 X-Sequence-Number: 18407 On Thu, Apr 13, 2006 at 08:36:09PM -0400, Tom Lane wrote: > Jim Nasby writes: > > While working on determining a good stripe size for a database, I > > realized it would be handy to know what the average request size is. > > Getting this info is a simple matter of joining pg_stat_all_tables > > and pg_statio_all_tables and doing some math, but there's one issue > > I've found; it appears that there's no information on how many heap > > blocks were read in by an index scan. Is there any way to get that info? > > If the table is otherwise idle, the change in the table's entry in > pgstatio_all_tables should do, no? Ahh, ok, I see the heap blocks are counted. So I guess if you wanted to know what the average number of blocks read from the heap per request was you'd have to do heap_blks_read / ( seq_scan + idx_scan ), with the last two comming from pg_stat_all_tables. In my case it would be helpful to break the heap access numbers out between seqscans and index scans, since each of those represents very different access patterns. Would adding that be a mess? > (This is as of 8.1 ... older versions acted a bit differently IIRC.) Yeah; I recall that it was pretty confusing exactly how things were broken out and that you changed it as part of the bitmap scan work. -- 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