From: | Josh Berkus <josh(at)agliodbs(dot)com> |
---|---|
To: | pgsql-performance(at)postgresql(dot)org |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Craig James <craig_james(at)emolecules(dot)com> |
Subject: | Re: count * performance issue |
Date: | 2008-03-08 01:27:35 |
Message-ID: | 200803071727.36146.josh@agliodbs.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Tom,
> > Count() on Oracle and MySQL is almost instantaneous, even for very
> > large tables. So why can't Postgres do what they do?
>
> AFAIK the above claim is false for Oracle. They have the same
> transactional issues we do.
Nope. Oracle's MVCC is implemented through rollback segments, rather than
non-overwriting the way ours is. So Oracle can just do a count(*) on the
index, then check the rollback segment for any concurrent
update/delete/insert activity and adjust the count. This sucks if there's
a *lot* of concurrent activity, but in the usual case it's pretty fast.
I've been thinking that when we apply the Dead Space Map we might be able
to get a similar effect in PostgreSQL. That is, just do a count over the
index, and visit only the heap pages flagged in the DSM. Again, for a
heavily updated table this wouldn't have any benefit, but for most cases
it would be much faster.
--
--Josh
Josh Berkus
PostgreSQL @ Sun
San Francisco
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2008-03-08 01:38:15 | Re: count * performance issue |
Previous Message | Josh Berkus | 2008-03-08 01:23:24 | Re: Why the difference in plans ? |