Files
documentdb/pg_documentdb/include/index_am/documentdb_rum.h
T
Vinod Sridharan 6349b5adca Merged PR 1633710: [Composite POC] Improve performance on multi-key path scenarios
### Does this PR have any customer impact?
Yes

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

### 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
For multi-key paths, track them on insert/update.

When doing a query, check the index for multi-key paths - if there are any then rewrite the query differently.

----
#### AI description  (iteration 1)
#### PR Classification
Performance improvement for multi-key path scenarios in composite indexes.

#### PR Summary
This pull request enhances the performance of multi-key path scenarios by introducing optimizations and refactoring the handling of composite indexes.
- `oss/pg_documentdb/src/index_am/rum.c`: Introduced `IndexMultiKeyStatus` enum and `CheckIndexHasArrays` function to optimize index scans.
- `oss/pg_documentdb/src/opclass/bson_gin_composite_core.c` and `oss/pg_documentdb/src/opclass/bson_gin_composite_entrypoint.c`: Added functions to merge single variable bounds and parse composite query specifications.
- `oss/pg_documentdb/include/index_am/documentdb_rum.h`: Updated function signatures to use `IndexAmRoutine` pointers.
- `pgmongo/src/helio_gin_am/helio_gin_utils.c`: Adjusted function calls to use `IndexAmRoutine` pointers.
- `pgmongo/src/metadata/oid_cache.c`: Changed `missingOk` parameter to `true` in `RunIndexOpAsUserProcedureId`.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
2025-04-10 10:29:08 -06:00

41 lines
1.4 KiB
C

/*-------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
*
* include/index_am/documentdb_rum.h
*
* Common declarations for RUM specific helper functions.
*
*-------------------------------------------------------------------------
*/
#ifndef DOCUMENTDB_RUM_H
#define DOCUMENTDB_RUM_H
#include <fmgr.h>
#include <access/amapi.h>
#include <nodes/pathnodes.h>
void LoadRumRoutine(void);
IndexAmRoutine *GetRumIndexHandler(PG_FUNCTION_ARGS);
IndexScanDesc extension_rumbeginscan_core(Relation rel, int nkeys, int norderbys,
IndexAmRoutine *coreRoutine);
void extension_rumendscan_core(IndexScanDesc scan, IndexAmRoutine *coreRoutine);
void extension_rumrescan_core(IndexScanDesc scan, ScanKey scankey, int nscankeys,
ScanKey orderbys, int norderbys,
IndexAmRoutine *coreRoutine);
int64 extension_rumgetbitmap_core(IndexScanDesc scan, TIDBitmap *tbm,
IndexAmRoutine *coreRoutine);
bool extension_rumgettuple_core(IndexScanDesc scan, ScanDirection direction,
IndexAmRoutine *coreRoutine);
void extension_rumcostestimate(PlannerInfo *root, IndexPath *path, double
loop_count,
Cost *indexStartupCost, Cost *indexTotalCost,
Selectivity *indexSelectivity,
double *indexCorrelation,
double *indexPages);
#endif