From 727d4836d2feb99f3f45116e5a2978803a207878 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Wed, 22 Oct 2025 11:47:11 -0700 Subject: [PATCH] Fixed Index Searches in EXPLAIN output for Postgres 18 --- CHANGELOG.md | 4 ++++ src/hnswscan.c | 4 ++++ src/ivfscan.c | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8618d1a..a351559 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.8.2 (unreleased) + +- Fixed `Index Searches` in `EXPLAIN` output for Postgres 18 + ## 0.8.1 (2025-09-04) - Added support for Postgres 18 rc1 diff --git a/src/hnswscan.c b/src/hnswscan.c index 955998a..5c526f4 100644 --- a/src/hnswscan.c +++ b/src/hnswscan.c @@ -193,6 +193,10 @@ hnswgettuple(IndexScanDesc scan, ScanDirection dir) /* Count index scan for stats */ pgstat_count_index_scan(scan->indexRelation); +#if PG_VERSION_NUM >= 180000 + if (scan->instrument) + scan->instrument->nsearches++; +#endif /* Safety check */ if (scan->orderByData == NULL) diff --git a/src/ivfscan.c b/src/ivfscan.c index 6cc5d2e..b42ada1 100644 --- a/src/ivfscan.c +++ b/src/ivfscan.c @@ -355,6 +355,10 @@ ivfflatgettuple(IndexScanDesc scan, ScanDirection dir) /* Count index scan for stats */ pgstat_count_index_scan(scan->indexRelation); +#if PG_VERSION_NUM >= 180000 + if (scan->instrument) + scan->instrument->nsearches++; +#endif /* Safety check */ if (scan->orderByData == NULL)