Skip to content

improve(bq_driver): SQLForeign Key perf imporvement - #1614

Open
shivamd-gpartner wants to merge 2 commits into
mainfrom
SQLForeign_key_perf
Open

improve(bq_driver): SQLForeign Key perf imporvement#1614
shivamd-gpartner wants to merge 2 commits into
mainfrom
SQLForeign_key_perf

Conversation

@shivamd-gpartner

@shivamd-gpartner shivamd-gpartner commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Improve(bq_driver): Optimize SQLForeignKeys via tables.get REST API

SQLForeignKeys always ran an INFORMATION_SCHEMA query job.
When the FK table is given as an exact name (ODBC treats it as an
identifier, not a pattern), read tableConstraints from the tables.get REST
API instead and build the result set locally — same approach as the existing
SQLPrimaryKeys/SQLColumns optimizations. Covers FK-only and PK+FK cases;
names with % and the PK-only case keep the unchanged query path.

benchmark_summary_table.txt

@shivamd-gpartner
shivamd-gpartner marked this pull request as ready for review July 28, 2026 09:06
@shivamd-gpartner
shivamd-gpartner requested a review from a team as a code owner July 28, 2026 09:06
Comment thread cmake/PatchGoogleCloudCpp.cmake Outdated
# Patch table_constraints.cc: the BigQuery REST API returns the foreign key
# constraint name in the "name" field, but the minimal client only reads
# "keyName", so key_name always parses as empty. Read "name" first.
set(fk_name_search "void from_json(nlohmann::json const& j, ForeignKey& f) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets handle it in the implementation if possible. This patch file is only for resolving compilation issues.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed the dependency

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants