mirror of
https://github.com/FerretDB/documentdb.git
synced 2026-11-26 12:19:56 -05:00
### 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? Yes ### ChangeLog (Refer [Template](../oss/CHANGELOG.md)) ### Description 1) In the Gateway, when preparing queries, embed the commandKey and userOid. That way a given prepared query is unique for a given user and command. This can be used for a future optimization to cache ACL check results 2) Reduce serialization costs from GW -> BE: Don't send the database name in the query. This is already in the request as a '$db' field. Support suppressing this (add a GUC to rollback just in case) 3) In the backend start parsing the $db if it's not sent by the GW 4) From the commandFuncs -> Query we were going through a layer of fmgr. We don't need this. Instead call directly into the functions in C to avoid the fmgr overhead. Additionally for GetMore this means we don't need to repack the heap tuple. As part of this we discovered that registering functions in pg_dist_object can regress perf for dispatch functions. Add a test to validate which ones of these are public. ---- #### AI description (iteration 1) #### PR Classification Performance improvement. #### PR Summary This pull request focuses on enhancing the performance of read and query operations by optimizing function calls and parameter handling. - Refactored `ExecuteQueryCore` in `command_funcs.c` to improve query execution by directly calling specific functions and adding ACL checks. - Changed function signatures in `bson_aggregation_pipeline.h` to use `text` instead of `Datum` for database parameters, improving type consistency. - Added `aggregation_commands.h` to export new aggregation command functions. - Updated `PostgresClient.cs` to conditionally include database names in query parameters, enhancing query flexibility. - Introduced new configuration option `SendDatabaseNameInParams` in `PostgresTenantConfiguration.cs` to control database name parameterization. <!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->
26 lines
949 B
C
26 lines
949 B
C
/*-------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
*
|
|
* include/aggregation/aggregation_commands.h
|
|
*
|
|
* Exports for the aggregation external commands.
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
|
|
#ifndef DOCUMENTDB_AGGREGATION_COMMANDS_H
|
|
#define DOCUMENTDB_AGGREGATION_COMMANDS_H
|
|
|
|
|
|
extern Datum find_cursor_first_page(text *database, pgbson *findSpec, int64_t cursorId);
|
|
extern Datum aggregate_cursor_first_page(text *database, pgbson *aggregationSpec,
|
|
int64_t cursorId);
|
|
extern Datum aggregation_cursor_get_more(text *database, pgbson *getMoreSpec,
|
|
pgbson *cursorSpec, AttrNumber
|
|
maxResponseAttributeNumber);
|
|
|
|
extern Datum list_collections_first_page(text *database, pgbson *listCollectionsSpec);
|
|
extern Datum list_indexes_first_page(text *database, pgbson *listIndexesSpec);
|
|
|
|
#endif
|