Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 8FCDA9FBBFD for ; Thu, 22 Mar 2007 11:37:41 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 09718-01 for ; Thu, 22 Mar 2007 11:37:31 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id CFE7C9FBB91 for ; Thu, 22 Mar 2007 11:37:31 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.8/8.13.8) with ESMTP id l2MEbEga045881 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 22 Mar 2007 07:37:16 -0700 (MST) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.8/8.13.8) with ESMTP id l2MEbDBH035178; Thu, 22 Mar 2007 08:37:13 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.8/8.13.8/Submit) id l2MEbDSB035177; Thu, 22 Mar 2007 08:37:13 -0600 (MDT) (envelope-from mfuhr) Date: Thu, 22 Mar 2007 08:37:13 -0600 From: Michael Fuhr To: Andreas Kostyrka Cc: Andreas Tille , pgsql-performance@postgresql.org Subject: Re: Performance of count(*) Message-ID: <20070322143713.GA34905@winnie.fuhr.org> References: <20070322111044.GC4439@andi-lap.la.revver.com> <20070322122944.GD4439@andi-lap.la.revver.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070322122944.GD4439@andi-lap.la.revver.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/323 X-Sequence-Number: 23728 On Thu, Mar 22, 2007 at 01:29:46PM +0100, Andreas Kostyrka wrote: > * Andreas Tille [070322 13:24]: > > Well, to be honest I'm not really interested in the performance of > > count(*). I was just discussing general performance issues on the > > phone line and when my colleague asked me about the size of the > > database he just wonderd why this takes so long for a job his > > MS-SQL server is much faster. So in principle I was just asking > > a first question that is easy to ask. Perhaps I come up with > > more difficult optimisation questions. > > Simple. MSSQL is optimized for this case, and uses "older" > datastructures. PG uses a MVCC storage, which is not optimized for > this usecase. It's quite fast for different kinds of queries. Ask about performing concurrent selects, inserts, updates, and deletes in SQL Server and about the implications on ACID of locking hints such as NOLOCK. Then consider how MVCC handles concurrency without blocking or the need for dirty reads. -- Michael Fuhr