[PATCH] Use maintenance_io_concurrency for parallel index builds
Thread notes
1 note#bug
hackorum-bot#bug
@global #bug
Hi,
Parallel B-tree, GIN, and BRIN index builds currently use
effective_io_concurrency for heap scans because the scans do not
pass READ_STREAM_MAINTENANCE to the read stream.
The attached patch passes the maintenance context through the existing
scan flags, making these scans use maintenance_io_concurrency.
Serial index builds appear to have the same issue. Passing the flag
there seems to require extending the table scan interface, which
could be follow-up work.
---
Regards,
Jingtang Zhang
Hi,
Attached is v2, regenerated with git format-patch to fix cfbot's
"Patch format detection failed" error. No code changes from v1.
---
Best regards,
Jingtang
Hi Jingtang,
The problem is real, and the fix LGTM.
Passing the flag there seems to require extending the table scan
interface
Actually, no extension is needed: table_beginscan_common() already
accepts user_flags, so heapam_index_build_range_scan() can simply
call it directly and pass SO_MAINTENANCE.
BRIN's summarize_range() also goes through
heapam_index_build_range_scan(), so fixing the serial path would
switch it over. IMO, that counts as maintenance too.
Best regards,
Yuhang Qiu
Hi,
Actually, no extension is needed: table_beginscan_common() already
accepts user_flags, so heapam_index_build_range_scan() can simply
call it directly and pass SO_MAINTENANCE.BRIN's summarize_range() also goes through
heapam_index_build_range_scan(), so fixing the serial path would
switch it over. IMO, that counts as maintenance too.
Thanks for the review. Attached is v3, which also handles serial index
builds by calling table_beginscan_common() directly, as you suggested.
This covers BRIN range summarization too, without changing the API.
---
Regards,
Jingtang Zhang
Hi all,
I found another maintenance path using effective_io_concurrency:
the sequential heap scan in heapam_relation_copy_for_cluster().
This affects VACUUM FULL and the sequential scan paths of CLUSTER
and REPACK.
Attached is v4, which also passes SO_MAINTENANCE for this scan.
---
Regards,
Jingtang Zhang