improve DEBUG1 logging of parallel workers for CREATE INDEX?

From: Sami Imseih <samimseih(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: improve DEBUG1 logging of parallel workers for CREATE INDEX?
Date: 2025-01-03 18:30:14
Message-ID: CAA5RZ0trTUL6_vpvW79daGgkp7B-ZtWUc5yrPz5Sjm8Ns4KRgQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

While reviewing patch [1], I realized that the DEBUG1 message
for CREATE INDEX could do better in providing information
about parallel workers launched. Currently, the message just
shows how many workers are planned, but a user may want
to ensure that they have the appropriate number of workers
launched as well when they enable DEBUG1 logging.

Therefore, I want to suggest that instead of:

postgres=# CREATE INDEX tbl_c1 ON tbl(c1);
DEBUG: building index "tbl_c1" on table "tbl" with request for 2
parallel workers
DEBUG: index "tbl_c1" can safely use deduplication
CREATE INDEX

to enhance the message to:

postgres=# create index tbl_c1 on tbl(c1);
DEBUG: building index "tbl_c1" on table "tbl"
DEBUG: launched 0 parallel vacuum workers for index vacuuming (planned: 2)
DEBUG: index "tbl_c1" can safely use deduplication
CREATE INDEX
postgres=#

I prepared a simple patch, attached, for this. The log message matches
the format
used in VACUUM VERBOSE ( for consistency sake ).

Also, I think the documentation in [2] should be updated to mention that DEBUG1
can be used to view parallel worker usage for the build, but I have
not included it in
the patch yet.

Any thoughts?

[1] https://www.postgresql.org/message-id/CAA5RZ0tS%3DFmgku9%3DqCp-U4EBC-dqVtj%2Bv_EGrKV_NA%3DTHnUDsQ%40mail.gmail.com

[2] https://www.postgresql.org/docs/current/sql-createindex.html

Regards,

Sami Imseih
Amazon Web Services (AWS)

Attachment Content-Type Size
0001-improve-DEBUG1-logging-of-parallel-workers-for-CREAT.patch application/octet-stream 2.5 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2025-01-03 19:08:02 Re: Vacuum statistics
Previous Message Tom Lane 2025-01-03 18:12:43 Re: Fwd: Re: A new look at old NFS readdir() problems?