Обсуждение: Gauging progress of COPY?
Is there some clever way to gauge the progress of a COPY command? i.e. you know it has 10m rows, but you can't SELECT COUNT(*).
--
Wells Oliver
wells.oliver@gmail.com
wells.oliver@gmail.com
Wells Oliver <wells.oliver@gmail.com> writes: > Is there some clever way to gauge the progress of a COPY command? i.e. you > know it has 10m rows, but you can't SELECT COUNT(*). If it's a COPY IN (to a table) you could monitor growth of the physical size of the table, cf pg_relation_size(). This isn't terribly satisfactory if you're not clear on how much space each row will take, but it's something. regards, tom lane
On 1/20/22 12:00 PM, Wells Oliver wrote: > Is there some clever way to gauge the progress of a COPY command? i.e. you > know it has 10m rows, but you can't SELECT COUNT(*). Use a specific tool like pg_bulkload. -- Angular momentum makes the world go 'round.
Greetings, * Ron (ronljohnsonjr@gmail.com) wrote: > On 1/20/22 12:00 PM, Wells Oliver wrote: > >Is there some clever way to gauge the progress of a COPY command? i.e. you > >know it has 10m rows, but you can't SELECT COUNT(*). > > Use a specific tool like pg_bulkload. Or maybe just use pv if you're doing it through psql or such. Thanks, Stephen
Вложения
On Thu, Jan 20, 2022, 19:01 Wells Oliver <wells.oliver@gmail.com> wrote:
Is there some clever way to gauge the progress of a COPY command? i.e. you know it has 10m rows, but you can't SELECT COUNT(*).
If you can open a second connection, you can just query pg_stat_progress_copy.
/Magnus
On Sat, Jan 22, 2022, 3:09 AM Magnus Hagander <magnus@hagander.net> wrote:
On Thu, Jan 20, 2022, 19:01 Wells Oliver <wells.oliver@gmail.com> wrote:Is there some clever way to gauge the progress of a COPY command? i.e. you know it has 10m rows, but you can't SELECT COUNT(*).If you can open a second connection, you can just query pg_stat_progress_copy.
If COPY FROM STDIN the client can provide feedback since it is sending line by line.
If size known...1%...5%...
If number of rows known... 10000... 20000...
I would think even a semi capable bash script could do it.
-Greg