Re: improve DEBUG1 logging of parallel workers for CREATE INDEX?

From: Sami Imseih <samimseih(at)gmail(dot)com>
To: Guillaume Lelarge <guillaume(at)lelarge(dot)info>, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: improve DEBUG1 logging of parallel workers for CREATE INDEX?
Date: 2025-01-18 23:42:50
Message-ID: CAA5RZ0v1DsqibU_am-CGM=_ve4_YMH+PXyfPL64rBzCgojpVMg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The opinion in this thread is leaning towards a VERBOSE
option and I agree with this as it provides the users with a
much more intuitive way to gather parallel information about
parallel index builds. Also, the current DEBUG1 output is
useless as it is now.

Here is a v1 that implements CREATE INDEX (VERBOSE)
to output the parallel workers planned and launched.

A few points about this patch:

1/ the (VERBOSE) option is added after the INDEX.
It seemed better than adding it after the CREATE keyword
to make the option specific to the "CREATE INDEX" operation
rather than the "CREATE" operation which can be many
things.

2/ The workers launched is determined in the index AM,
therefore a new field called "ii_verbose" is added to IndexInfo
so it can be available to the AM to determine if logging
is required. We currently handle the concurrently
option in the same manner.

3/ currently REINDEX (VERBOSE) does not show parallel
workers planned, but it will with this patch. Both
CREATE INDEX and REINDEX will show the same output.

4/ Updated auto-completed in psql to deal with (VERBOSE)

5/ Removed the existing DEBUG1 output.

6/ Updated the tests for create index/reinde

Here is sample output:

postgres=# CREATE INDEX (VERBOSE ON) ON t(c1);
INFO: building index "t_c1_idx" on table "t" with parallel workers
INFO: launched 1 parallel workers for index creation (planned: 1)
INFO: index "public.t" was created
DETAIL: CPU: user: 0.88 s, system: 0.01 s, elapsed: 0.89 s.
CREATE INDEX
postgres=#
postgres=# REINDEX (verbose) INDEX t_c1_idx ;
INFO: building index "t_c1_idx" on table "t" with parallel workers
INFO: launched 1 parallel workers for index creation (planned: 1)
INFO: index "t_c1_idx" was reindexed
DETAIL: CPU: user: 0.88 s, system: 0.00 s, elapsed: 0.89 s
REINDEX

Looking forward to feedback.

Regards,

Sami

Attachment Content-Type Size
v1-0001-Improve-Parallel-worker-reporting-in-CREATE-INDEX.patch application/octet-stream 30.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yura Sokolov 2025-01-19 00:11:32 Get rid of WALBufMappingLock
Previous Message Tom Lane 2025-01-18 22:31:43 Re: [PATCH] immediately kill psql process if server is not running.