pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mark Mielke <mark@mark.mielke.cc>
To: Robins Tharakan <tharakan@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: count * performance issue
Date: Mon, 10 Mar 2008 23:01:51 -0400
Message-ID: <47D5F61F.4080305@mark.mielke.cc> (raw)
In-Reply-To: <36af4bed0803101957u6078127fq78dc3384fe78de5d@mail.gmail.com>
References: <f966c2ee0803052142l6a105678jfe2da92a0d9371@mail.gmail.com>
	<47D00DB2.7040007@emolecules.com>
	<18451.1204824562@sss.pgh.pa.us>
	<200803071727.36146.josh@agliodbs.com>
	<13345.1204940295@sss.pgh.pa.us>
	<87r6eia9tz.fsf@oxford.xeocode.com>
	<12ba3bf00803101354w15b023e1o237f564a1b01105f@mail.gmail.com>
	<Pine.GSO.4.64.0803101853090.25041@westnet.com>
	<36af4bed0803101957u6078127fq78dc3384fe78de5d@mail.gmail.com>

Robins Tharakan wrote:
> Hi,
>
> I have been reading this conversation for a few days now and I just 
> wanted to ask this. From the release notes, one of the new additions 
> in 8.3 is (Allow col IS NULL to use an index (Teodor)).
>
> Sorry, if I am missing something here, but shouldn't something like 
> this allow us to get a (fast) accurate count ?
>
> SELECT COUNT(*) from table WHERE indexed_field IS NULL
> +
> SELECT COUNT(*) from table WHERE indexed_field IS NOT NULL

For PostgreSQL: You still don't know whether the row is visible until 
you check the row. That it's NULL or NOT NULL does not influence this truth.

Cheers,
mark

-- 
Mark Mielke <mark@mielke.cc>

view thread (62+ messages)  latest in thread

Message-ID: <47D5F61F.4080305@mark.mielke.cc>
Permalink:  ../47D5F61F.4080305@mark.mielke.cc/
Also on:    postgresql.org/message-id/47D5F61F.4080305@mark.mielke.cc

 · 

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: mark@mark.mielke.cc, tharakan@gmail.com
  Subject: Re: count * performance issue
  In-Reply-To: <47D5F61F.4080305@mark.mielke.cc>

* 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