public inbox for [email protected]help / color / mirror / Atom feed
pgsql: Remove HeapBitmapScan's skip_fetch optimization 6+ messages / 1 participants [nested] [flat]
* pgsql: Remove HeapBitmapScan's skip_fetch optimization @ 2025-04-02 19:35 Andres Freund <[email protected]> 0 siblings, 0 replies; 6+ messages in thread From: Andres Freund @ 2025-04-02 19:35 UTC (permalink / raw) To: [email protected] Remove HeapBitmapScan's skip_fetch optimization The optimization does not take the removal of TIDs by a concurrent vacuum into account. The concurrent vacuum can remove dead TIDs and make pages ALL_VISIBLE while those dead TIDs are referenced in the bitmap. This can lead to a skip_fetch scan returning too many tuples. It likely would be possible to implement this optimization safely, but we don't have the necessary infrastructure in place. Nor is it clear that it's worth building that infrastructure, given how limited the skip_fetch optimization is. In the backbranches we just disable the optimization by always passing need_tuples=true to table_beginscan_bm(). We can't perform API/ABI changes in the backbranches and we want to make the change as minimal as possible. Author: Matthias van de Meent <[email protected]> Reported-By: Konstantin Knizhnik <[email protected]> Discussion: https://postgr.es/m/CAEze2Wg3gXXZTr6_rwC+s4-o2ZVFB5F985uUSgJTsECx6AmGcQ@mail.gmail.com Backpatch-through: 13 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/459e7bf8e2f8ab894dc613fa8555b74c4eef6969 Modified Files -------------- src/backend/access/heap/heapam.c | 61 ++++--------------------------- src/backend/access/heap/heapam_handler.c | 46 +---------------------- src/backend/executor/nodeBitmapHeapscan.c | 15 +------- src/include/access/heapam.h | 12 +----- src/include/access/tableam.h | 12 +----- 5 files changed, 13 insertions(+), 133 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Remove HeapBitmapScan's skip_fetch optimization @ 2025-04-02 19:35 Andres Freund <[email protected]> 0 siblings, 0 replies; 6+ messages in thread From: Andres Freund @ 2025-04-02 19:35 UTC (permalink / raw) To: [email protected] Remove HeapBitmapScan's skip_fetch optimization The optimization does not take the removal of TIDs by a concurrent vacuum into account. The concurrent vacuum can remove dead TIDs and make pages ALL_VISIBLE while those dead TIDs are referenced in the bitmap. This can lead to a skip_fetch scan returning too many tuples. It likely would be possible to implement this optimization safely, but we don't have the necessary infrastructure in place. Nor is it clear that it's worth building that infrastructure, given how limited the skip_fetch optimization is. In the backbranches we just disable the optimization by always passing need_tuples=true to table_beginscan_bm(). We can't perform API/ABI changes in the backbranches and we want to make the change as minimal as possible. Author: Matthias van de Meent <[email protected]> Reported-By: Konstantin Knizhnik <[email protected]> Discussion: https://postgr.es/m/CAEze2Wg3gXXZTr6_rwC+s4-o2ZVFB5F985uUSgJTsECx6AmGcQ@mail.gmail.com Backpatch-through: 13 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/980727b84107f88cecfd4b94fe80269d948633c4 Modified Files -------------- src/backend/executor/nodeBitmapHeapscan.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Remove HeapBitmapScan's skip_fetch optimization @ 2025-04-02 19:35 Andres Freund <[email protected]> 0 siblings, 0 replies; 6+ messages in thread From: Andres Freund @ 2025-04-02 19:35 UTC (permalink / raw) To: [email protected] Remove HeapBitmapScan's skip_fetch optimization The optimization does not take the removal of TIDs by a concurrent vacuum into account. The concurrent vacuum can remove dead TIDs and make pages ALL_VISIBLE while those dead TIDs are referenced in the bitmap. This can lead to a skip_fetch scan returning too many tuples. It likely would be possible to implement this optimization safely, but we don't have the necessary infrastructure in place. Nor is it clear that it's worth building that infrastructure, given how limited the skip_fetch optimization is. In the backbranches we just disable the optimization by always passing need_tuples=true to table_beginscan_bm(). We can't perform API/ABI changes in the backbranches and we want to make the change as minimal as possible. Author: Matthias van de Meent <[email protected]> Reported-By: Konstantin Knizhnik <[email protected]> Discussion: https://postgr.es/m/CAEze2Wg3gXXZTr6_rwC+s4-o2ZVFB5F985uUSgJTsECx6AmGcQ@mail.gmail.com Backpatch-through: 13 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/78cb2466f75280da70461f8b9ae3d1062c884214 Modified Files -------------- src/backend/executor/nodeBitmapHeapscan.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Remove HeapBitmapScan's skip_fetch optimization @ 2025-04-02 19:35 Andres Freund <[email protected]> 0 siblings, 0 replies; 6+ messages in thread From: Andres Freund @ 2025-04-02 19:35 UTC (permalink / raw) To: [email protected] Remove HeapBitmapScan's skip_fetch optimization The optimization does not take the removal of TIDs by a concurrent vacuum into account. The concurrent vacuum can remove dead TIDs and make pages ALL_VISIBLE while those dead TIDs are referenced in the bitmap. This can lead to a skip_fetch scan returning too many tuples. It likely would be possible to implement this optimization safely, but we don't have the necessary infrastructure in place. Nor is it clear that it's worth building that infrastructure, given how limited the skip_fetch optimization is. In the backbranches we just disable the optimization by always passing need_tuples=true to table_beginscan_bm(). We can't perform API/ABI changes in the backbranches and we want to make the change as minimal as possible. Author: Matthias van de Meent <[email protected]> Reported-By: Konstantin Knizhnik <[email protected]> Discussion: https://postgr.es/m/CAEze2Wg3gXXZTr6_rwC+s4-o2ZVFB5F985uUSgJTsECx6AmGcQ@mail.gmail.com Backpatch-through: 13 Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/b9ec8125d167df445c7a310f6b5aa1448009cbaa Modified Files -------------- src/backend/executor/nodeBitmapHeapscan.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Remove HeapBitmapScan's skip_fetch optimization @ 2025-04-02 19:35 Andres Freund <[email protected]> 0 siblings, 0 replies; 6+ messages in thread From: Andres Freund @ 2025-04-02 19:35 UTC (permalink / raw) To: [email protected] Remove HeapBitmapScan's skip_fetch optimization The optimization does not take the removal of TIDs by a concurrent vacuum into account. The concurrent vacuum can remove dead TIDs and make pages ALL_VISIBLE while those dead TIDs are referenced in the bitmap. This can lead to a skip_fetch scan returning too many tuples. It likely would be possible to implement this optimization safely, but we don't have the necessary infrastructure in place. Nor is it clear that it's worth building that infrastructure, given how limited the skip_fetch optimization is. In the backbranches we just disable the optimization by always passing need_tuples=true to table_beginscan_bm(). We can't perform API/ABI changes in the backbranches and we want to make the change as minimal as possible. Author: Matthias van de Meent <[email protected]> Reported-By: Konstantin Knizhnik <[email protected]> Discussion: https://postgr.es/m/CAEze2Wg3gXXZTr6_rwC+s4-o2ZVFB5F985uUSgJTsECx6AmGcQ@mail.gmail.com Backpatch-through: 13 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/77d90d6d6334cbd0a423637e4306727bce2437f1 Modified Files -------------- src/backend/executor/nodeBitmapHeapscan.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Remove HeapBitmapScan's skip_fetch optimization @ 2025-04-02 19:35 Andres Freund <[email protected]> 0 siblings, 0 replies; 6+ messages in thread From: Andres Freund @ 2025-04-02 19:35 UTC (permalink / raw) To: [email protected] Remove HeapBitmapScan's skip_fetch optimization The optimization does not take the removal of TIDs by a concurrent vacuum into account. The concurrent vacuum can remove dead TIDs and make pages ALL_VISIBLE while those dead TIDs are referenced in the bitmap. This can lead to a skip_fetch scan returning too many tuples. It likely would be possible to implement this optimization safely, but we don't have the necessary infrastructure in place. Nor is it clear that it's worth building that infrastructure, given how limited the skip_fetch optimization is. In the backbranches we just disable the optimization by always passing need_tuples=true to table_beginscan_bm(). We can't perform API/ABI changes in the backbranches and we want to make the change as minimal as possible. Author: Matthias van de Meent <[email protected]> Reported-By: Konstantin Knizhnik <[email protected]> Discussion: https://postgr.es/m/CAEze2Wg3gXXZTr6_rwC+s4-o2ZVFB5F985uUSgJTsECx6AmGcQ@mail.gmail.com Backpatch-through: 13 Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/4934d38759cdb65965db4ccf10aa767d9bee5e00 Modified Files -------------- src/backend/executor/nodeBitmapHeapscan.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2025-04-02 19:35 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2025-04-02 19:35 pgsql: Remove HeapBitmapScan's skip_fetch optimization Andres Freund <[email protected]> 2025-04-02 19:35 pgsql: Remove HeapBitmapScan's skip_fetch optimization Andres Freund <[email protected]> 2025-04-02 19:35 pgsql: Remove HeapBitmapScan's skip_fetch optimization Andres Freund <[email protected]> 2025-04-02 19:35 pgsql: Remove HeapBitmapScan's skip_fetch optimization Andres Freund <[email protected]> 2025-04-02 19:35 pgsql: Remove HeapBitmapScan's skip_fetch optimization Andres Freund <[email protected]> 2025-04-02 19:35 pgsql: Remove HeapBitmapScan's skip_fetch optimization Andres Freund <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox