what is the purpose to use 3 function to compare cost add_path/set_cheapest/get_cheapest_fractional_path

Поиск
Список
Период
Сортировка
От Andy Fan
Тема what is the purpose to use 3 function to compare cost add_path/set_cheapest/get_cheapest_fractional_path
Дата
Msg-id CAKU4AWoEF4MozNLiFNyfLBFMGWE_qC=RUB5h+065wgY54G2H1A@mail.gmail.com
обсуждение исходный текст
Ответы Re: what is the purpose to use 3 function to compare cost add_path/set_cheapest/get_cheapest_fractional_path  (Amit Kapila <amit.kapila16@gmail.com>)
Список pgsql-hackers
Hello Hackers:
   I'm reading the code of optimizer and get confused about the 3 functions. add_path/set_cheapest/get_cheapest_fractional_path


add_(partial_)path:
For every relations,  optimizer will build path for it and add then call add_path to the rel->pathlist.  during this stage,  it compare the current rel->pathlist with the new one,  then it may discard it or add it into the pathlist.   finally we may have multi path now. 

set_cheapest
after we finished the add_path for each relation,  we will call set_cheapest,  the cheapest is the one with the lowest total cost plus the parameterized path.  

get_cheapest_fractional_path
after we build the paths for all the relation,  it calls get_cheapest_fractional_path to get the best path and then build the plan. 

so my question is why do we need to have the 3 cost compare function? 

and i have another real case,  and hope you can provide some hints:

select * from t1 where slow_func(t1.a,  3) == true;  ==>  parallel bitmap index scan. 

select * from t1, t2 where t2.pk = 1 and t1.b = t2.b and slow_function(t1.a,  t2.a) == true; ==> I get nest loop without parallel scan.  what I hope is  after I get the t2.a (only 1 value),  I want to go with parallel index scan as well. 

In this case,  which part should I focus on to figure out the issue? 


Thanks

В списке pgsql-hackers по дате отправления:

Предыдущее
От: vignesh C
Дата:
Сообщение: closesocket behavior in different platforms
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Update minimum SSL version