From: | Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | what is the purpose to use 3 function to compare cost add_path/set_cheapest/get_cheapest_fractional_path |
Date: | 2019-12-06 05:56:01 |
Message-ID: | CAKU4AWoEF4MozNLiFNyfLBFMGWE_qC=RUB5h+065wgY54G2H1A@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2019-12-06 06:20:32 | Re: Update minimum SSL version |
Previous Message | vignesh C | 2019-12-06 05:53:45 | closesocket behavior in different platforms |