Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id ED4811337B4E for ; Tue, 26 Oct 2010 09:20:40 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 77610-10 for ; Tue, 26 Oct 2010 12:20:34 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-gy0-f174.google.com (mail-gy0-f174.google.com [209.85.160.174]) by mail.postgresql.org (Postfix) with ESMTP id 7F8611337B51 for ; Tue, 26 Oct 2010 09:20:33 -0300 (ADT) Received: by gyg4 with SMTP id 4so2756155gyg.19 for ; Tue, 26 Oct 2010 05:20:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=n1DF45uaj6ymC/JQ2yhBhRWXPht92pZAsUKRtEdhkiM=; b=K8YJzRkNo66exf9jEPYLDNqIy6ZJurQHb9wi6qBA0YoV0Pyf2yLt3/R8/TulQ30TKz Xpdz2uprZjfSlqzyN9bOJpfsSegVXhw9JbnDgqjwOh2B0KAJU8rxDjtL0PDZOl0Q056V v+vPuoxLF6avIdmPpoV1iqhbmB2VKC1vaWdGU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=o01ooIVj3+H1jwRtq9LIz/cnO7niUE2AM8u6GHM7wUGxgvDvC21pyjv2kQFjCz7qvO 1nfJE4uVnJg7qbEZyJ+84+K9KEUrT0aCyfx8p/TzFn1CJG++C56PaXgF7kySB6KBBxT9 C+cfMKuP8l070Rx5zg31tY6Vb2Jq7cbynyxQg= MIME-Version: 1.0 Received: by 10.42.175.201 with SMTP id bb9mr926443icb.255.1288095633137; Tue, 26 Oct 2010 05:20:33 -0700 (PDT) Received: by 10.231.111.229 with HTTP; Tue, 26 Oct 2010 05:20:33 -0700 (PDT) In-Reply-To: References: <4CC6C287.8070803@mejor.pl> Date: Tue, 26 Oct 2010 13:20:33 +0100 Message-ID: Subject: Re: which one is faster From: =?UTF-8?Q?Grzegorz_Ja=C5=9Bkiewicz?= To: Szymon Guz Cc: =?UTF-8?Q?Marcin_Miros=C5=82aw?= , pgsql-performance@postgresql.org Content-Type: text/plain; charset=UTF-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201010/425 X-Sequence-Number: 40843 2010/10/26 Szymon Guz : > > Well, strange. Why is that slower? To answer that fully, you would need to see the implementation. suffice to say, count(a) does: if (a <> NULL) { count++; } and count(*) does: count++; -- GJ