Re: Index on a NULL-value

От: Tobias Brox
Тема: Re: Index on a NULL-value
Дата: ,
Msg-id: 20050531032119.GH26100@tobias.exoweb.net
(см: обсуждение, исходный текст)
Ответ на: Index on a NULL-value  (Tobias Brox)
Ответы: Re: Index on a NULL-value  (Bruno Wolff III)
Список: pgsql-performance

Скрыть дерево обсуждения

Index on a NULL-value  (Tobias Brox, )
 Re: Index on a NULL-value  (Bruno Wolff III, )
  Re: Index on a NULL-value  (Tobias Brox, )
   Re: Index on a NULL-value  (Bruno Wolff III, )
 Re: Index on a NULL-value  (Tobias Brox, )
  Re: Index on a NULL-value  (Bruno Wolff III, )
   Re: Index on a NULL-value  (Tobias Brox, )
    Re: Index on a NULL-value  (Greg Stark, )
     Re: Index on a NULL-value  (Tom Lane, )
   Re: Index on a NULL-value  (Tom Lane, )
    Re: Index on a NULL-value  (Tobias Brox, )
 Re: Index on a NULL-value  (Tobias Brox, )

[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


В списке pgsql-performance по дате сообщения:

От: Tobias Brox
Дата:
Сообщение: Re: Index on a NULL-value
От: "Praveen Raja"
Дата:
Сообщение: very large table