Hi.

Inspired by [1]
There is an opportunity for optimization according to the commit:
2904324 <http://2904324a88f672b2ecc22735279c16d6e1ee178c>
" Due to splitting the block id into two 16 bit integers, BlockIdSet() is
more expensive than one might think. Doing it once per returned tuple shows
up as a small but reliably reproducible cost. It's simple enough to set the
block number just once per block in pagemode, so do so."

By moving the invariants out of the loop, it really is an improvement.

Then the following sources can be optimized:
contrib/pg_visibility/pg_visibility.c
contrib/pgstattuple/pgstatapprox.c
src/backend/access/heap/heapam.c
src/backend/access/heap/heapam_handler.c
src/backend/access/heap/pruneheap.c
src/backend/access/heap/vacuumlazy.c
src/backend/commands/dbcommands.c

Attached all patchs.

best regards,
Ranier Vilela

[1] Re: AIO writes vs hint bits vs checksums
<https://www.postgresql.org/message-id/lxzj26ga6ippdeunz6kuncectr5gfuugmm2ry22qu6hcx6oid6@lzx3sjsqhmt6>

Attachment: pg_visibility_set_tuple_block_once.patch
Description: Binary data

Attachment: pgstattuple_set_tuple_block_once.patch
Description: Binary data

Attachment: heapam_set_tuple_block_once.patch
Description: Binary data

Attachment: heapam_handler_set_tuple_block_once.patch
Description: Binary data

Attachment: pruneheap_set_tuple_block_once.patch
Description: Binary data

Attachment: vacuumlazy_set_tuple_block_once.patch
Description: Binary data

Attachment: dbcommands_set_tuple_block_once.patch
Description: Binary data

Reply via email to