Re: In-order pg_dump (or in-order COPY TO)

From: Dimitrios Apostolou <jimis(at)gmx(dot)net>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: In-order pg_dump (or in-order COPY TO)
Date: 2025-08-27 12:40:57
Message-ID: 6n801oq1-r471-0488-pn6s-8nn3o95o9r47@tzk.arg
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tuesday 2025-08-26 22:31, David G. Johnston wrote:

>The logical dump has no ordering - it will come out however it comes out.  "COPY <table> TO ..." doesn't have an order by clause - there is no way to make or communicate to it that ordering is important.  For adhoc work you can use "COPY <query> TO ..." and put and order by in the query.

Thank you, so it's not possible currently.

How would "COPY <query> TO" behave for copying very large tables?
Would it make sense to optionally have that in pg_dump?

Or would it make sense as a new feature, to optionally order "COPY
<table> TO ..." based on primary key where available, and use that in
pg_dump option?

Dimitris

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dimitrios Apostolou 2025-08-27 12:52:39 Re: In-order pg_dump (or in-order COPY TO)
Previous Message Dimitrios Apostolou 2025-08-27 12:34:31 Re: In-order pg_dump (or in-order COPY TO)