Re: assertion failure at cost_memoize_rescan()

2024-06-18 Thread David Rowley
On Tue, 18 Jun 2024 at 15:14, Richard Guo wrote: > > On Tue, Jun 18, 2024 at 10:53 AM David Rowley wrote: > > I think the best solution is to apply the attached. I didn't test, > > but it should fix the issue you reported and also ensure that > > MemoizePath.calls is never zero, which would also

Re: assertion failure at cost_memoize_rescan()

2024-06-17 Thread Richard Guo
On Tue, Jun 18, 2024 at 10:53 AM David Rowley wrote: > Out of the places I saw, it seems we do tend to code things so that we > don't assume the value has been clamped. E.g. > adjust_limit_rows_costs() does if (*rows < 1) *rows = 1; Agreed. In costsize.c I saw a few instances where we have

Re: assertion failure at cost_memoize_rescan()

2024-06-17 Thread David Rowley
On Tue, 18 Jun 2024 at 14:23, Kohei KaiGai wrote: > > 2024年6月17日(月) 8:27 David Rowley : > > It would be good to know what type of Path outer_path is. Normally > > we'll clamp_row_est() on that field. I suspect we must have some Path > > type that isn't doing that. > > > > KaiGai-san, what type o

Re: assertion failure at cost_memoize_rescan()

2024-06-17 Thread Kohei KaiGai
2024年6月17日(月) 8:27 David Rowley : > > On Mon, 17 Jun 2024 at 10:23, Tomas Vondra > wrote: > > Interesting. Seems like a bug due to the two places clamping the values > > inconsistently. It probably does not matter in other contexts because we > > don't subtract the values like this, but here it tr

Re: assertion failure at cost_memoize_rescan()

2024-06-16 Thread David Rowley
On Mon, 17 Jun 2024 at 10:23, Tomas Vondra wrote: > Interesting. Seems like a bug due to the two places clamping the values > inconsistently. It probably does not matter in other contexts because we > don't subtract the values like this, but here it triggers the assert. > > I guess the simplest fi

Re: assertion failure at cost_memoize_rescan()

2024-06-16 Thread Tomas Vondra
On 6/14/24 14:54, Kohei KaiGai wrote: > ... > > I tracked the behavior of estimate_num_groups() using gdb line-by-line to > observe how 'input_rows' is changed > and how it affects the result value. > According to the call trace, the problematic estimate_num_groups() > invocation is called with "in

assertion failure at cost_memoize_rescan()

2024-06-14 Thread Kohei KaiGai
Hello, I met an assertion failure, and identified the root of the problem, but no idea how to fix it. The location of the problematic Assert() is at cost_memoize_rescan() to check 'hit_ratio' is between 0.0 and 1.0. The 'calls' is provided by the caller, and 'ndistinct' is the result of estimate_