Re: Checking join outer relation uniqueness to prevent unnecessary memoization
| От | David Rowley |
|---|---|
| Тема | Re: Checking join outer relation uniqueness to prevent unnecessary memoization |
| Дата | |
| Msg-id | CAApHDvpEziKD4uXOm4ySe7UKZiy4dSeH0Eo+K_O-M-dyYmGUUw@mail.gmail.com обсуждение исходный текст |
| Ответ на | Checking join outer relation uniqueness to prevent unnecessary memoization (Jacob Jackson <jej.jackson.08@gmail.com>) |
| Ответы |
Re: Checking join outer relation uniqueness to prevent unnecessary memoization
|
| Список | pgsql-hackers |
On Fri, 2 Jan 2026 at 04:30, Jacob Jackson <jej.jackson.08@gmail.com> wrote: > The current memoization cost calculation method often results in memoize nodes being added even when they are useless dueto the outer side of the join being guaranteed unique due to constraints, increasing overhead unnecessarily. To try toprevent this, I am exploring methods to check whether the outer side of the join is guaranteed unique before adding memoizenodes. The simplest method I have found thus far is to use innerrel_is_unique, passing in the outer relation wherethe inner relation normally would be. This appears to work (although it is logically different from the other uses ofinnerrel_is_unique), and adds negligible overhead for simple joins because it can often reuse cached values from otherpotential join orders. Do you have an example case of this happening? Ideally, the code that should disfavour Memoize for this case is estimate_num_groups() as called in cost_memoize_rescan() by returning that there's 1 group per input row. I guess that's not happening for this case? Why? David
В списке pgsql-hackers по дате отправления: