Repository navigation
Fixes 24101: stop MSSQL GetTables/GetViews from timing out on large catalogs - #32014
Conversation
GetTables/GetViews used inspector.get_table_names()/get_view_names(), which query INFORMATION_SCHEMA with an ORDER BY and no row cap. On a schema with hundreds of thousands of tables, SQL Server has to sort every row before returning one, which blows past the per-step test-connection timeout and aborts real ingestion before it starts. Replace them with a TOP 1, no-ORDER-BY existence probe against sys.tables/sys.views, filtered to is_ms_shipped = 0 so a probe against a system database (master, msdb) still reports on real user objects instead of SQL Server's own tables/views. Fixes #24101
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
✅ Playwright Results — workflow succeededValidated commit ✅ 110 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 52m 38s ⏱️ Max setup 6m 34s · max shard execution 13m 3s · max shard-job elapsed before upload 22m 1s · reporting 4s 🌐 217.40 requests/attempt · 1.79 app boots/UI scenario · 0.00% common-shard skew Optimization targets still in progress:
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
Code Review ✅ ApprovedReplaces full catalog sorting with a fast TOP 1 index seek in MSSQL GetTables and GetViews to prevent ingestion timeouts on large databases. No issues found. OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
🚦 Removed from the merge queue —
|
🚦 Removed from the merge queue —
|
|
Failed to cherry-pick changes to the 2.0 branch. |
|
Failed to cherry-pick changes to the 1.13 branch. |
MSSQL drops out of this change: main's #32014 replaced its GetTables/GetViews reflection with a TOP 1 sys.tables/sys.views existence probe, which selects no schema, so there is no schema filter to apply. Took main's file verbatim. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ion per driver, bound query timeouts (#32574) (#33924) Backport of #32574 to 2.0. Resolved against 2.0 rather than taken wholesale, because the squashed commit carries context from changes 2.0 does not have: - the bundled UI schema copies under ui/src/jsons/ingestionSchemas and ui/public/jsons/connectionSchemas are deleted on 2.0, so they stay deleted; the description edit reaches SSIS and WhereScape through the $ref they already have on mssqlConnection.json - MSSQL_GET_QUERY_STORE_STATE keeps 2.0's own statement, since the extra column belongs to a different change - the GetTables/GetViews probe tests and the `replace` import they need come from #32014, which is not on 2.0, so neither is brought along 145 unit tests pass across the MSSQL and SSL suites.
…og (#32014) (#35906) GetTables/GetViews used inspector.get_table_names()/get_view_names(), which query INFORMATION_SCHEMA with an ORDER BY and no row cap. On a schema with hundreds of thousands of tables, SQL Server has to sort every row before returning one, which blows past the per-step test-connection timeout and aborts real ingestion before it starts. Replace them with a TOP 1, no-ORDER-BY existence probe against sys.tables/sys.views, filtered to is_ms_shipped = 0 so a probe against a system database (master, msdb) still reports on real user objects instead of SQL Server's own tables/views. Fixes #24101 (cherry picked from commit f8c5d97) Co-authored-by: Akash Verma <138790903+akashverma0786@users.noreply.github.com>



Describe your changes:
Fixes #24101
GetTables/GetViewsusedinspector.get_table_names()/get_view_names(), which queryINFORMATION_SCHEMAwith anORDER BYand no row cap. On a schema with hundreds of thousands of tables, SQL Server has to sort every row before returning even one — reproduced live against a real SQL Server instance with ~600k tables in one schema:GetTablestook 87.7s,GetViews44.4s, both past the 60s per-step timeout, failing the whole test connection and aborting real ingestion before it started (GetTablesis a mandatory step, andtest_connection()runs unconditionally before any real extraction).Replaced both with a
TOP 1, no-ORDER BYexistence probe againstsys.tables/sys.views— SQL Server can satisfy that with an index seek instead of a full sort, so it stays fast regardless of catalog size. Filtered tois_ms_shipped = 0so a probe against a system database (master,msdb) still reports on real user objects instead of SQL Server's own tables/views (master.spt_values,msdb's ~150 system tables/views) — verified directly against both.Re-validated against the same ~600k-table instance after the fix:
GetTables/GetViewsnow resolve in the same instant as the other checks, and the full test connection reportsSuccessful.Type of change:
High-level design:
N/A — small change, contained to the MSSQL connector's test-connection checks.
Tests:
Use cases covered
GetTables/GetViewsreturn in milliseconds regardless of table/view count (verified live against a ~600k-table SQL Server instance).no tables visiblewith a caveat (a warning, not a failure); zero views stays silent, matching pre-existing behavior.Unit tests
ingestion/tests/unit/source/database/mssql/test_connection.pyTOP 1, noORDER BY,is_ms_shipped = 0) and the found/empty/caveat behavior for bothGetTablesandGetViews.Backend integration tests
Ingestion integration tests
Playwright (UI) tests
Manual testing performed
metadata ingestCLI:GetTablesfailed after 87.7s,GetViewsafter 44.4s, both exceeding the per-step timeout.GetTables/GetViewsresolve instantly, test connection reportsSuccessful, and real ingestion proceeds.is_ms_shipped = 0directly againstmasterandmsdb— confirmed real system objects (spt_values,sysnotifications, etc.) are excluded from the probe's results.UI screen recording / screenshots:
Not applicable.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.Greptile Summary
The PR replaces MSSQL table and view enumeration during connection testing with bounded
TOP 1catalog probes.sys.tablesandsys.views.Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
TOP 1MSSQL catalog queries that exclude Microsoft-shipped objects and avoid sorting.Reviews (2): Last reviewed commit: "Merge branch 'main' into fix-24101" | Re-trigger Greptile