Inspecting the status of a long-running COPY statement
1
vote
1
answer
1101
views
I need to migrate a table from one PostgreSQL database to another. There was a chance I would need to fix some data, so I exported to a CSV. Then I imported the CSV in the second database with a
COPY
statement.
This process has been running for 5 days now. The only way I found to inspect its progress was to compare the sizes on disk. The original table was 95 GB (from psql's \dt+
), and the CSV was 40 GB. So I thought I could compare the new table size with those numbers. I thought that the new table would stop at 95 GB, or even before. Instead, it's now at 103 GB and who knows when it will stop.
Of course, select count(*)
does not work because the copy happens in its own transaction so the rows are shielded until it's done. But I know that the the table has about 1500 million rows. So if somehow I could get an estimate of the number of rows currently in the new table I could compare.
Asked by rubik
(535 rep)
Jul 8, 2019, 03:15 PM
Last activity: Jul 1, 2022, 05:45 AM
Last activity: Jul 1, 2022, 05:45 AM