Re: Generic Plans for Prepared Statement are 158155 times slower than Custom Plans

2019-04-29 Thread Tom Lane
Andres Freund writes: > On 2019-04-29 10:35:39 -0400, Tom Lane wrote: >> This isn't the first time we've seen a plan-choice failure of this sort. >> I've wondered if we should make the plancache simply disbelieve generic >> cost estimates that are actually cheaper than the custom plans, on the >>

Re: Generic Plans for Prepared Statement are 158155 times slower than Custom Plans

2019-04-29 Thread Andres Freund
Hi, On 2019-04-29 10:35:39 -0400, Tom Lane wrote: > This isn't the first time we've seen a plan-choice failure of this sort. > I've wondered if we should make the plancache simply disbelieve generic > cost estimates that are actually cheaper than the custom plans, on the > grounds that they must b

Re: Generic Plans for Prepared Statement are 158155 times slower than Custom Plans

2019-04-29 Thread Tom Lane
Bruce Momjian writes: > On Mon, Apr 29, 2019 at 10:36:20AM +, Naik, Sameer wrote: >> Since Postgres 9.2, for prepared statements, the CBO automatically switches >> from Custom Plan to Generic plan on the sixth iteration (reference backend/ >> utils/cache/plancache.c). > This is not totally tr

Re: Generic Plans for Prepared Statement are 158155 times slower than Custom Plans

2019-04-29 Thread Bruce Momjian
On Mon, Apr 29, 2019 at 10:36:20AM +, Naik, Sameer wrote: > Hi, > > Since Postgres 9.2, for prepared statements, the CBO automatically switches > from Custom Plan to Generic plan on the sixth iteration (reference backend/ > utils/cache/plancache.c). This is not totally true. The PREPARE manu