Files
Vinod Sridharan df1e6f4e61 Merged PR 1773287: [Explain] A few explain scan improvements based on recent investigations
### Does this PR have any customer impact?
Yes

### Type (Feature, Refactoring, Bugfix, DevOps, Testing, Perf, etc)
Feature

### Does it involve schema level changes? (Table, Column, Index, UDF, etc level changes)
No

### Are you introducing any new config? If yes, do you have tests with and without them being set?
No
### ChangeLog (Refer [Template](../oss/CHANGELOG.md))

### Description

A few explain improvements:
1) Push index usage under each index IXSCAN node (rather than at the top level aggregated)
2) Add a bool for indexonlyscan and add number of heap fetches under indexonlyscan
3) Only mark a scan as _id_ and COLLSCAN if it's an unsharded lookup with no object_id filter
4) For BitmapAnd, don't add an unnecessary FETCH stage before the bitmapindexscan IXSCAN
5) Don't print the index name in the parent FETCH stage of an ixscan
6) For aggregation scans, push the indexdetails to the $cursor stage (as opposed to next level stages).
7) In the backend - handle BitmapAnd for explain scan.

Other bugs found in this:
1) Don't skip writing WAL for multikey status after index build (since the whole page image is already marked for WAL before that point)
2) Don't call ginUpdateStats (call rumUpdateStats) in parallel index build.

----
#### AI description  (iteration 1)
#### PR Classification
This PR enhances explain scan functionality by improving index usage reporting and scan diagnostics across multiple components.

#### PR Summary
The changes refine the explain plan output for various scan types by better handling index conditions, propagating index details, and introducing new diagnostic fields.
- `PostgresExplainHelper.cs`: Refactored index condition processing, improved index usage reporting, and added flags like `isIndexOnlyScan` and handling for heap fetches.
- `mod.rs` (in pg_documentdb_gw explain): Updated query planning and execution stats logic to support Bitmap Index Scan and propagate index details into inner plans.
- C source files (`index_am/rum_adapter.c` and `custom_explain_scan.c`): Simplified WAL logging, improved multi-key index status updating, and added handling for BitmapAndState in scan explanations.
- `utf8.strings.csv`: Added new keys (`isIndexOnlyScan` and `totalDocsAnalyzed`) to support the enhanced explain output.
- `CHANGELOG.md`: Documented the explain scan improvements as a new feature.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
2025-08-21 20:14:39 +08:00
..