Re: [PERFORM] Optimization inner join

От: Phillip Couto
Тема: Re: [PERFORM] Optimization inner join
Дата: ,
Msg-id: 497e3581-bcce-4efc-b281-6b17a93479c4@mtasv.net
(см: обсуждение, исходный текст)
Ответ на: [PERFORM] Optimization inner join  (Clailson)
Ответы: Re: [PERFORM] Optimization inner join  (Clailson)
Re: [PERFORM] Optimization inner join  (Vitalii Tymchyshyn)
Список: pgsql-performance

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

[PERFORM] Optimization inner join  (Clailson, )
 Re: [PERFORM] Optimization inner join  ("Phillip Couto" , )
  Re: [PERFORM] Optimization inner join  (Clailson, )
   Re: [PERFORM] Optimization inner join  ("Phillip Couto" , )
   Re: [PERFORM] Optimization inner join  (Gustavo Rezende Montesino, )
    Re: [PERFORM] Optimization inner join  (Tom Lane, )
     Re: [PERFORM] Optimization inner join  (Gustavo Rezende Montesino, )
    Re: [PERFORM] Optimization inner join  ("Phillip Couto" , )
  Re: [PERFORM] Optimization inner join  (Vitalii Tymchyshyn, )
   Re: [PERFORM] Optimization inner join  ("Phillip Couto" , )

NULL is still a value that may be paired with a NULL in a.a

The only optimization I could see is if the a.a column has NOT NULL defined while b.b does not have NOT NULL defined.

Not sure if it is all that common. Curious what if you put b.b IS NOT NULL in the WHERE statement?

-----------------
Phillip Couto



On Jan 19, 2017, at 05:08, Clailson <> wrote:

Hi,

Is there something in the roadmap to optimize the inner join?

I've this situation
above. Table b has 400 rows with null in the column b.

explain analyze select * from a inner join b on (b.b = a.a);
"Merge Join  (cost=0.55..65.30 rows=599 width=16) (actual time=0.030..1.173 rows=599 loops=1)" 
"  Merge Cond: (a.a = b.b)" 
"  ->  Index Scan using a_pkey on a  (cost=0.28..35.27 rows=1000 width=8) (actual time=0.014..0.364 rows=1000 loops=1)" 
"  ->  Index Scan using in01 on b  (cost=0.28..33.27 rows=1000 width=8) (actual time=0.012..0.249 rows=600 loops=1)" 
"Total runtime: 1.248 ms" 

My question is: Why the planner isn't removing the null rows during the scan of table b?
-- 
Clailson Soares Dinízio de Almeida


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

От: Albe Laurenz
Дата:
Сообщение: Re: [PERFORM] Chaotic query planning ?
От: Dinesh Chandra 12108
Дата:
Сообщение: [PERFORM] Backup taking long time !!!