Re: Patch to fix FK-related selectivity estimates with constants

2020-10-28 Thread Alvaro Herrera
On 2020-Oct-28, Tom Lane wrote: > Alvaro Herrera writes: > > I think if a struct is used as a function argument somewhere or arrays > > of the struct are formed, then it's certain that changing that struct's > > size is going to cause problems. > > I grasp the point about arrays, but not sure h

Re: Patch to fix FK-related selectivity estimates with constants

2020-10-28 Thread Tom Lane
Alvaro Herrera writes: > On 2020-Oct-27, Tom Lane wrote: >> * Changing the set of fields in ForeignKeyOptInfo is an ABI break. >> We could minimize the risk by adding the new fields at the end in >> the back branches, but it still wouldn't be zero-risk. > It'd be useful to be able to qualify this

Re: Patch to fix FK-related selectivity estimates with constants

2020-10-28 Thread Alvaro Herrera
On 2020-Oct-27, Tom Lane wrote: > I had two concerns about possible extension breakage from a back-patch: > > * Changing the set of fields in ForeignKeyOptInfo is an ABI break. > We could minimize the risk by adding the new fields at the end in > the back branches, but it still wouldn't be zero-r

Re: Patch to fix FK-related selectivity estimates with constants

2020-10-27 Thread Tomas Vondra
On Tue, Oct 27, 2020 at 09:27:06PM -0400, Tom Lane wrote: Tomas Vondra writes: On Tue, Oct 27, 2020 at 01:58:56PM -0400, Tom Lane wrote: Attached is a patch series that attacks it that way. The patch sems fine to me, thanks for investigating and fixing this. Thanks for looking at it! I

Re: Patch to fix FK-related selectivity estimates with constants

2020-10-27 Thread Tom Lane
Tomas Vondra writes: > On Tue, Oct 27, 2020 at 01:58:56PM -0400, Tom Lane wrote: >>> Attached is a patch series that attacks it that way. > The patch sems fine to me, thanks for investigating and fixing this. Thanks for looking at it! > I find it a bit strange that generate_base_implied_equalit

Re: Patch to fix FK-related selectivity estimates with constants

2020-10-27 Thread Tomas Vondra
On Tue, Oct 27, 2020 at 01:58:56PM -0400, Tom Lane wrote: I wrote: Over in the thread at [1] it's discussed how our code for making selectivity estimates using knowledge about FOREIGN KEY constraints is busted in the face of EquivalenceClasses including constants. ... Attached is a patch series

Re: Patch to fix FK-related selectivity estimates with constants

2020-10-27 Thread Tom Lane
I wrote: > Over in the thread at [1] it's discussed how our code for making > selectivity estimates using knowledge about FOREIGN KEY constraints > is busted in the face of EquivalenceClasses including constants. > ... > Attached is a patch series that attacks it that way. I'd failed to generate a