Re: speedup COPY TO for partitioned table.

Melih Mutlu <m.melihmutlu@gmail.com>

From: Melih Mutlu <m.melihmutlu@gmail.com>
To: jian he <jian.universality@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-01-21T22:54:32Z
Lists: pgsql-hackers
Hi Jian,

Thanks for the patch.

jian he <jian.universality@gmail.com>, 19 Ara 2024 Per, 15:03 tarihinde
şunu yazdı:

> attached copy_par_regress_test.sql is a simple benchmark sql file,
> a partitioned table with 10 partitions, 2 levels of indirection.
> The simple benchmark shows around 7.7% improvement in my local environment.
>

I confirm that the patch introduces some improvement in simple cases like
the one you shared. I looked around a bit to understand whether there is an
obvious reason why copying from a partitioned table is not allowed, but
couldn't find one. It seems ok to me.
I realized that while both "COPY <partitioned_table> TO..." and "COPY
(SELECT..) TO..." can return the same set of rows, their orders may not be
the same. I guess that it's hard to guess in which
order find_all_inheritors() would return tables, and that might be
something we should be worried about with the patch. What do you think?

Thanks,
-- 
Melih Mutlu
Microsoft

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Support COPY TO for partitioned tables.

  2. Re-implement the ereport() macro using __VA_ARGS__.