Re: [PATCH] Simple progress reporting for COPY command - Mailing list pgsql-hackers

From Tomas Vondra
Subject Re: [PATCH] Simple progress reporting for COPY command
Date
Msg-id 6e7b056e-faff-40f6-730d-3ad6d2d1b5e9@enterprisedb.com
Whole thread Raw
In response to Re: [PATCH] Simple progress reporting for COPY command  (Josef Šimánek <josef.simanek@gmail.com>)
Responses Re: [PATCH] Simple progress reporting for COPY command
List pgsql-hackers
Hi,

I did take a quick look today, and I have a couple minor comments:

1) The catalog sgml docs seem to mention bytes_processed twice (one of 
that should be bytes_total), and line_processed (should be "lines_").


2) I'm not quite sure about not including any info about the command. 
For example pg_stat_progress_create_index includes info about the 
command, although it's not very detailed. Not sure how useful would it 
be to show just COPY FROM / COPY TO, without more details.

It's probably possible to extract this from pg_stat_activity, but that 
may be rather cumbersome (parsing arbitrary SQL and all that). Also, 
what if the COPY is called from a function etc.?


3) I wonder if we should have something like lines_estimated. For COPY 
TO it's pretty simple to calculate it as

     bytes_total / (bytes_processed / lines_processed)

but what about

     COPY (query) TO file

In that case we don't know the total amount of bytes / rows, so we can't 
calculate any estimate. So maybe we could peek into the query plan? But 
I agree this is something we can add later.


4) This comment is a bit confusing, as it mixes "total" and "processed". 
I'd just say "number of bytes processed so far" instead.



Other than that, it seems fine. I'm sure we could add more features, but 
it seems like a good start - I plan to get this committed once I get a 
patch fixing the docs issues.

regards

-- 
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: language cleanups in code and docs
Next
From: Peter Smith
Date:
Subject: Fix typo in comment