Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieve a progress of index creation process in PostgreSQL

Tags:

postgresql

Consider long-running query in PostgreSQL of index creation, smth like that:

CREATE INDEX some_idx   
   ON some_table   USING btree  
      (some_varchar_column COLLATE pg_catalog."default");

The question is: how to retrieve the progress of this query process? Is it possible or not?

It is interesting to know the way in both cases:

  1. using pgAdmin
  2. using SQL
  3. using some internal postgreSQL tools.

May be this additional info could influence on the answer: PostgreSQL 9.3 on Windows 7 64 bit.

like image 806
Andremoniy Avatar asked Oct 20 '22 15:10

Andremoniy


2 Answers

There's a wiki page on this very topic, which links to several links. Their accuracy is in question as of a few years ago. There's also a thread on hackers from 2006 or 2007 regarding adding progress indicators within which, EnterpriseDBs Greg Stark makes the same point.

like image 182
hd1 Avatar answered Oct 23 '22 04:10

hd1


In Postgres v12+ the view pg_stat_progress_create_index should give you this information.

https://www.postgresql.org/docs/12/progress-reporting.html

like image 25
Robins Tharakan Avatar answered Oct 23 '22 06:10

Robins Tharakan