DBAtlas · Database operations atlas

View progress of long-running operations

Oracle

SELECT sid, serial#, opname, target, sofar, totalwork,
       ROUND(sofar / NULLIF(totalwork,0) * 100, 2) AS pct_done,
       time_remaining, elapsed_seconds
FROM v$session_longops
WHERE totalwork > 0 AND sofar < totalwork
ORDER BY start_time;

v$session_longops shows the percentage progress and remaining time (time_remaining) of operations running longer than 6 seconds.

PostgreSQL

SELECT pid, phase, heap_blks_total, heap_blks_scanned,
       ROUND(heap_blks_scanned::numeric / NULLIF(heap_blks_total,0) * 100, 2) AS pct
FROM pg_stat_progress_vacuum;
-- Others: pg_stat_progress_create_index, _cluster, _analyze, _copy, _basebackup

The pg_stat_progress_* views report the progress of VACUUM, CREATE INDEX, CLUSTER, ANALYZE, and COPY operations.

MySQL

SELECT t.processlist_id, st.event_name, st.work_completed, st.work_estimated,
       ROUND(st.work_completed / NULLIF(st.work_estimated,0) * 100, 2) AS pct
FROM performance_schema.events_stages_current st
JOIN performance_schema.threads t ON t.thread_id = st.thread_id
WHERE st.work_estimated > 0;

When stage instrumentation is enabled, events_stages_current shows progress via work_completed/work_estimated (e.g. ALTER TABLE).

SQL Server

SELECT session_id, command, percent_complete,
       DATEADD(ms, estimated_completion_time, GETDATE()) AS est_finish,
       total_elapsed_time / 1000 AS elapsed_sec
FROM sys.dm_exec_requests
WHERE percent_complete > 0
ORDER BY percent_complete;

sys.dm_exec_requests.percent_complete gives the percentage for operations such as BACKUP, RESTORE, DBCC, and index rebuilds.

MongoDB

db.currentOp({ "active": true, "secs_running": { "$gte": 3 } })

In the db.currentOp output, long-running operations and, for index builds, the 'progress' field (done/total) show progress.

Redis

INFO persistence
# Keys: rdb_bgsave_in_progress, aof_rewrite_in_progress, rdb_last_bgsave_status, loading, loading_loaded_perc

The INFO persistence section reports whether RDB/AOF save or rewrite operations are in progress and the loading percentage.

Elasticsearch

GET _tasks?detailed=true&actions=*reindex,*update/byquery,*delete/byquery
# For recovery/shard relocation: GET _cat/recovery?v&active_only=true

_tasks?detailed shows the status of long-running tasks (reindex, update_by_query); _cat/recovery shows active shard recovery progress.

Open in DBAtlas →