pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Smith <gsmith@gregsmith.com>
To: pgsql-performance@postgresql.org
Subject: Re: count * performance issue
Date: Thu, 6 Mar 2008 10:49:33 -0500 (EST)
Message-ID: <Pine.GSO.4.64.0803061043100.25105@westnet.com> (raw)
In-Reply-To: <20080306153639.GA19442@samfundet.no>
References: <bf54be870803052215y5bb56235k5ea05ada1d701022@mail.gmail.com>
	<47CF8EA6.8070503@mark.mielke.cc>
	<20080306063643.GB21084@a-kretschmer.de>
	<f966c2ee0803052243w723e2866gbfc37128620d1c6d@mail.gmail.com>
	<B94D3180-BB72-43EB-BA1E-90CF53705386@fastcrypt.com>
	<f966c2ee0803060358k14dd7374h8ef3f4ca0818b04@mail.gmail.com>
	<3E9C3A51-C28E-4B75-9739-E344DAC72880@fastcrypt.com>
	<f966c2ee0803060443j3d9c1b66x5f59e00d084e841c@mail.gmail.com>
	<Pine.GSO.4.64.0803060813570.11897@westnet.com>
	<47D00DB2.7040007@emolecules.com>
	<20080306153639.GA19442@samfundet.no>

On Thu, 6 Mar 2008, Steinar H. Gunderson wrote:

> On Thu, Mar 06, 2008 at 07:28:50AM -0800, Craig James wrote:
>> Count() on Oracle and MySQL is almost instantaneous, even for very large
>> tables. So why can't Postgres do what they do?
>
> In MySQL's case: Handle transactions. (Try COUNT(*) on an InnoDB table.)

Exactly.  There is a good discussion of this at 
http://www.mysqlperformanceblog.com/2007/04/10/count-vs-countcol/ and I 
found the comments from Ken Jacobs were the most informative.

In short, if you want any reasonable database integrity you have to use 
InnoDB with MySQL, and once you make that choice it has the same problem. 
You only get this accelerated significantly when using MyISAM, which can 
tell you an exact count of all the rows it hasn't corrupted yet.

--
* Greg Smith gsmith@gregsmith.com http://www.gregsmith.com Baltimore, MD



view thread (62+ messages)  latest in thread

Message-ID: <Pine.GSO.4.64.0803061043100.25105@westnet.com>
Permalink:  ../Pine.GSO.4.64.0803061043100.25105@westnet.com/
Also on:    postgresql.org/message-id/Pine.GSO.4.64.0803061043100.25105@westnet.com

 · 

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: gsmith@gregsmith.com
  Subject: Re: count * performance issue
  In-Reply-To: <Pine.GSO.4.64.0803061043100.25105@westnet.com>

* 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