pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Christopher Browne <cbbrowne@libertyrms.info>
Cc: pgsql-performance@postgresql.org
Subject: Re: count(*) slow on large tables
Date: Sat, 4 Oct 2003 14:19:46 -0400 (EDT)
Message-ID: <200310041819.h94IJkV07596@candle.pha.pa.us> (raw)
In-Reply-To: <19444.1065289898@sss.pgh.pa.us>

Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> 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.

OK, I beefed up the TODO:

	* Use a fixed row count and a +/- count with MVCC visibility rules
	  to allow fast COUNT(*) queries with no WHERE clause(?)

I can always give the details if someone asks.  It doesn't seem complex
enough for a separate TODO.detail item.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073



view thread (30+ messages)  latest in thread

Message-ID: <200310041819.h94IJkV07596@candle.pha.pa.us>
Permalink:  ../200310041819.h94IJkV07596@candle.pha.pa.us/
Also on:    postgresql.org/message-id/200310041819.h94IJkV07596@candle.pha.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: pgman@candle.pha.pa.us, tgl@sss.pgh.pa.us, cbbrowne@libertyrms.info
  Subject: Re: count(*) slow on large tables
  In-Reply-To: <200310041819.h94IJkV07596@candle.pha.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox