I was looking at the comments [1] for why COPY FREEZE is
not allowed on a parent table, and it was mainly due
to having to open up partitions to check if they are able
to take the optimization (table created or truncated in the
current transaction ). Obviously as the number of
partitions grow, it will take more to perform these
checks. My suspicious is that in the cases in which partitions
are used, the benefits of COPY FREEZE could outweigh
the overhead of these additional checks.
So while we could try to solve the COPY FREEZE issue
specifically for pgbench, I wonder if we should try to do better
and see if the limitation on a parent partition can be removed.
I can provide a patch and some benchmark numbers unless
there is something bigger I am missing about the reason this
limitation exists?
[1] https://github.com/postgres/postgres/blob/master/src/backend/commands/copyfrom.c#L727-L735
Regards,
Sami