Gregory Stark <stark(at)enterprisedb(dot)com> writes:
> I think there's still a problem here with some kind of n^2 behaviour for
> appends of very wide tables but I haven't quite nailed it yet. In any case is
> there any reason not to make the following small change to move the constraint
> exclusion ahead of the size estimates and index checks and save ourselves
> potentially a lot of work?
Applied along with some other hacking to reduce the costs of the
lower-level functions that this example shows to be inefficient.
They'd still be slow in large queries, whether CE applies or not.
regards, tom lane