maxim(dot)boguk(at)gmail(dot)com writes:
> I found case when custom plans with partitioning shows strange behavior.
> First 5 repetitions of execute with the same parameters I getting fast
> custom plan, on 6th run plan switch to slow generic (all-partitions)
> version.
This behavior is expected; after half a dozen trials the plancache will
decide it's not getting enough win from custom plans to justify replanning
every time. For a cost delta of about 0.6 unit I would have to agree with
it. You may have a real case where it's doing something wrong, but this
toy example doesn't demonstrate a bug IMO.
regards, tom lane