Skip to content
TheChatArchiveThe Chat Archive
Amazon Novaamazon.nova-pro-v1:0· AmazonHugging Face LMArena Human Preference 140K

postgres query to see all ongoing index creation progress

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with DeepSeekdeepseek-v3-0324’s answer.
  1. User

    postgres query to see all ongoing index creation progress

  2. Amazon Nova Assistant

    To monitor the progress of ongoing index creation in PostgreSQL, you can use the pg_stat_progress_create_index view. This view provides detailed information about the progress of index creation operations.

    Here's a query to see all ongoing index creation progress:

    SELECT
        pid,
        indexrelid::regclass AS index_name,
        heap_tuples_total AS total_tuples,
        heap_tuples_done AS done_tuples,
        heap_tuples_total - heap_tuples_done AS remaining_tuples,
        CASE
            WHEN heap_tuples_total = 0 THEN 0
            ELSE (heap_tuples_done::float / heap_tuples_total::float) * 100
        END AS percent_complete,
        phase
    FROM
        pg_stat_progress_create_index;
    

    Explanation of Columns:

    • pid: The process ID of the backend performing the index creation.
    • index_name: The name of the index being created.
    • total_tuples: The total number of tuples to be processed.
    • done_tuples: The number of tuples that have been processed so far.
    • remaining_tuples: The number of tuples remaining to be processed.
    • percent_complete: The percentage of the index creation that is complete.
    • phase: The current phase of the index creation process.

    Notes:

    • The pg_stat_progress_create_index view is available in PostgreSQL 9.6 and later.
    • The phase column can have values such as heap_scan, index_build, finalize, etc., indicating the current stage of the index creation process.

    This query will give you a comprehensive view of the progress of all ongoing index creation operations in your PostgreSQL database.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.