Skip to content

Useful code for checking progress during indexing #8

@Chloe-Meinshausen

Description

@Chloe-Meinshausen

Hi all,
just wanted to share this very helpful query that will check the status on the create index process. -I have one thats been running for almost 24 hours and seeing the progress creep up has been a stress relief.

This is the results you get if you run it in pgadmin.

image

      SELECT
        now()::TIME(0),
        a.query,
        p.phase,
        round(p.blocks_done / p.blocks_total::numeric * 100, 2) AS "% done",
        p.blocks_total,
        p.blocks_done,
        p.tuples_total,
        p.tuples_done,
        ai.schemaname,
        ai.relname,
        ai.indexrelname
      FROM pg_stat_progress_create_index p
      JOIN pg_stat_activity a ON p.pid = a.pid
      LEFT JOIN pg_stat_all_indexes ai on ai.relid = p.relid AND ai.indexrelid = p.index_relid;

source:
https://dba.stackexchange.com/questions/11329/monitoring-progress-of-index-construction-in-postgresql/249784#249784?newreg=7a3d794dcb154b6782ca390ead375050

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions