I wrote:
> "Kumar, Sachin" <ssetiya@amazon.com> writes:
>> I was not able to find email thread which details why we are not using
>> parallel pg_restore for pg_upgrade.
> Well, it's pretty obvious isn't it? The parallelism is being applied
> at the per-database level instead.
On further reflection, there is a very good reason why it's done like
that. Because pg_upgrade is doing schema-only dump and restore,
there's next to no opportunity for parallelism within either pg_dump
or pg_restore. There's no data-loading steps, and there's no
index-building either, so the time-consuming stuff that could be
parallelized just isn't happening in pg_upgrade's usage.
Now it's true that my 0003 patch moves the needle a little bit:
since it makes BLOB creation (as opposed to loading) parallelizable,
there'd be some hope for parallel pg_restore doing something useful in
a database with very many blobs. But it makes no sense to remove the
existing cross-database parallelism in pursuit of that; you'd make
many more people unhappy than happy.
Conceivably something could be salvaged of your idea by having
pg_upgrade handle databases with many blobs differently from
those without, applying parallelism within pg_restore for the
first kind and then using cross-database parallelism for the
rest. But that seems like a lot of complexity compared to the
possible win.
In any case I'd stay far away from using --section in pg_upgrade.
Too many moving parts there.
regards, tom lane