Is there any way to determine how many rows a transaction has modified (before the transaction ends)?

by Giacomo Alzetta   Last Updated February 11, 2019 09:06 AM - source

I have a ~320 million row table on which I run the following query:

UPDATE my_table SET state = TRIM(state)

Needless to say this has been running for 90+ hours (since thursday afternoon) and has not finished yet. Even

I'd like to know, more or less, how many rows it has modified until now. Is there any way to obtain this information from the running transaction?

Trying to search I have found how to determine a rough estimate of how many new rows are being added to a table using the pgstattuple function:

select dead_tuple_count from pgstattuple('my_table');

But this does not seem to show any interesting information for how many rows have been modified.

Related Questions

Grafana Dashboard for postgres_exporter queries

Updated March 06, 2019 07:06 AM

Check lock count for PostgreSQL

Updated March 17, 2017 17:06 PM