mirror of
https://github.com/postgres/postgres.git
synced 2025-10-22 14:32:25 +03:00
Report progress of COPY commands
This commit introduces a view pg_stat_progress_copy, reporting progress of COPY commands. This allows rough estimates how far a running COPY progressed, with the caveat that the total number of bytes may not be available in some cases (e.g. when the input comes from the client). Author: Josef Šimánek Reviewed-by: Fujii Masao, Bharath Rupireddy, Vignesh C, Matthias van de Meent Discussion: https://postgr.es/m/CAFp7QwqMGEi4OyyaLEK9DR0+E+oK3UtA4bEjDVCa4bNkwUY2PQ@mail.gmail.com Discussion: https://postgr.es/m/CAFp7Qwr6_FmRM6pCO0x_a0mymOfX_Gg+FEKet4XaTGSW=LitKQ@mail.gmail.com
This commit is contained in:
@@ -154,6 +154,7 @@ typedef struct CopyFromStateData
|
||||
char *raw_buf;
|
||||
int raw_buf_index; /* next byte to process */
|
||||
int raw_buf_len; /* total # of bytes stored */
|
||||
uint64 bytes_processed;/* number of bytes processed so far */
|
||||
/* Shorthand for number of unconsumed bytes available in raw_buf */
|
||||
#define RAW_BUF_BYTES(cstate) ((cstate)->raw_buf_len - (cstate)->raw_buf_index)
|
||||
} CopyFromStateData;
|
||||
|
@@ -133,4 +133,9 @@
|
||||
#define PROGRESS_BASEBACKUP_PHASE_WAIT_WAL_ARCHIVE 4
|
||||
#define PROGRESS_BASEBACKUP_PHASE_TRANSFER_WAL 5
|
||||
|
||||
/* Commands of PROGRESS_COPY */
|
||||
#define PROGRESS_COPY_BYTES_PROCESSED 0
|
||||
#define PROGRESS_COPY_BYTES_TOTAL 1
|
||||
#define PROGRESS_COPY_LINES_PROCESSED 2
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user