pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tobias Brox <tobias@nordicbet.com>
To: pgsql-performance@postgresql.org
Subject: Re: Index on a NULL-value
Date: Tue, 31 May 2005 11:21:20 +0800
Message-ID: <20050531032119.GH26100@tobias.exoweb.net> (raw)
In-Reply-To: <20050531030207.GD26100@tobias.exoweb.net>
References: <20050531030207.GD26100@tobias.exoweb.net>

[Tobias Brox - Tue at 11:02:07AM +0800]
> test=# explain select * from mock where b is NULL;
>                              QUERY PLAN                             
> --------------------------------------------------------------------
>  Seq Scan on mock (cost=100000000.00..100000020.00 rows=6 width=8)
>    Filter: (b IS NULL)
> (2 rows)

(...)

> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
>       joining column's datatypes do not match

That tip helped me :-)

test=# explain select * from mock where (b IS NULL)=true;
                              QUERY PLAN                              

----------------------------------------------------------------------
 Index Scan using b_is_null on mock  (cost=0.00..4.68 rows=1 width=8)
   Index Cond: ((b IS NULL) = true)
(2 rows)

-- 
Tobias Brox, Beijing



view thread (12+ messages)  latest in thread

Message-ID: <20050531032119.GH26100@tobias.exoweb.net>
Permalink:  ../20050531032119.GH26100@tobias.exoweb.net/
Also on:    postgresql.org/message-id/20050531032119.GH26100@tobias.exoweb.net

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-performance@postgresql.org
  Cc: tobias@nordicbet.com
  Subject: Re: Index on a NULL-value
  In-Reply-To: <20050531032119.GH26100@tobias.exoweb.net>
  References: <20050531030207.GD26100@tobias.exoweb.net> <20050531032119.GH26100@tobias.exoweb.net>

* 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