X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 02660D1B567 for ; Sat, 4 Oct 2003 17:52:29 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 45461-06 for ; Sat, 4 Oct 2003 14:51:43 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id ECE16D1B523 for ; Sat, 4 Oct 2003 14:51:41 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h94Hpchn019445; Sat, 4 Oct 2003 13:51:39 -0400 (EDT) To: Bruce Momjian Cc: Christopher Browne , pgsql-performance@postgresql.org Subject: Re: count(*) slow on large tables In-reply-to: <200310041748.h94Hmlc04602@candle.pha.pa.us> References: <200310041748.h94Hmlc04602@candle.pha.pa.us> Comments: In-reply-to Bruce Momjian message dated "Sat, 04 Oct 2003 13:48:47 -0400" Date: Sat, 04 Oct 2003 13:51:38 -0400 Message-ID: <19444.1065289898@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/143 X-Sequence-Number: 3891 Bruce Momjian writes: > Tom Lane wrote: >> ... and it would give the wrong answers. Unless the cache is somehow >> snapshot-aware, so that it can know which other transactions should be >> included in your count. > The cache is an ordinary table, with xid's on every row. I meant it > would require no index/heap scans of the large table --- it would still > require a scan of the "count" table. Oh, that idea. Yeah, I think we had concluded it might work. You'd better make the TODO item link to that discussion, because there's sure been plenty of discussion of ideas that wouldn't work. regards, tom lane