Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 70DAC2E0035 for ; Wed, 14 May 2008 23:41:02 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 28842-08 for ; Wed, 14 May 2008 23:40:53 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.30]) by developer.postgresql.org (Postfix) with ESMTP id 6E80E2E002D for ; Wed, 14 May 2008 23:40:59 -0300 (ADT) Received: by yw-out-2324.google.com with SMTP id 3so108781ywj.73 for ; Wed, 14 May 2008 19:40:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=X2QJPtEQOt+TdEZmaOgw6LgwXG35aJmzIO8mD7mt/U4=; b=JpoIjNWrK/n28xL5oCeJAhOxN33v1XTY6uq17pefh9eHqrc/gF6lv2XdGEA+pW3DU5IT8Jm5EfonKBsG0V+1OIshQkhjW5k+4NpcPR3sgjXrYgDSJ3s3r4lbDZBggDLuSsfUUnbRK6d2C6OQ0CaMVDQ1R4jbTcuqeN336SpPVPY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=LAaoQmZBMwQytDT2o6zHsAqQWJ9DXTSg4zMDCzLjYIEmEh7+Mv6k86zUUkLTcC1H8KlxANF6IROQBvIThH+fO87FC36fWH5tgq8wcsqrLT9RPz+kV4kq0N5jTuGrXx3nedgHLjkA0wYlJ3lsWk6tC+wx/B2Tyu4JRqyWibea+Vk= Received: by 10.151.83.12 with SMTP id k12mr1818502ybl.1.1210819258319; Wed, 14 May 2008 19:40:58 -0700 (PDT) Received: by 10.151.84.7 with HTTP; Wed, 14 May 2008 19:40:58 -0700 (PDT) Message-ID: <2e78013d0805141940x50c3f51u439019e8e592959@mail.gmail.com> Date: Thu, 15 May 2008 08:10:58 +0530 From: "Pavan Deolasee" To: "Greg Smith" Subject: Re: I/O on select count(*) Cc: "Alvaro Herrera" , pgsql-performance@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <920841.71690.qm@web44808.mail.sp1.yahoo.com> <482B1D5F.EE98.0025.0@wicourts.gov> <20080515020553.GN9838@alvh.no-ip.org> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200805/193 X-Sequence-Number: 30161 On Thu, May 15, 2008 at 7:51 AM, Greg Smith wrote: > > > So is vacuum helpful here because it will force all that to happen in one > batch? To put that another way: if I've run a manual vacuum, is it true > that it will have updated all the hint bits to XMIN_COMMITTED for all the > tuples that were all done when the vacuum started? > Yes. For that matter, even a plain SELECT or count(*) on the entire table is good enough. That will check every tuple for visibility and set it's hint bits. Another point to note is that the hint bits are checked and set on a per tuple basis. So especially during index scan, the same heap page may get rewritten many times. I had suggested in the past that whenever we set hint bits for a tuple, we should check all other tuples in the page and set their hint bits too to avoid multiple writes of the same page. I guess the idea got rejected because of lack of benchmarks to prove the benefit. Thanks, Pavan -- Pavan Deolasee EnterpriseDB http://www.enterprisedb.com