Skip to content

perf(drivers): widen the SSH window and cut SQL driver round trips - #4331

Merged
datlechin merged 6 commits into
mainfrom
perf/sql-driver-round-trips
Nov 18, 2026
Merged

datlechin merged 6 commits into
mainfrom
perf/sql-driver-round-trips

Conversation

@datlechin

Copy link
Copy Markdown
Member

Summary

  • P12 SSH: forward channels open with libssh2_channel_open_ex and a 32 MiB receive window, on macOS and iOS.
  • P13 Oracle: streamed reads use the buffered fetch policy, 1,000 rows per fetch. The first response carries the capped reader's row budget, up to 10,000 rows.
  • P30 libSQL: Run sends one SELECT with a limit one row past the cap, and a local read stops stepping at the cap. The statement check moves from the D1 driver to SQLStatementRowLimit.boundedRead.
  • P31 Snowflake: single-table columns, row count, size and comment read SHOW COLUMNS and SHOW TABLES, with no warehouse. INFORMATION_SCHEMA stays the fallback, and the schema-wide column read stays on it because SHOW stops at 10,000 rows.
  • P31 Snowflake: SHOW TABLES LIKE results match the exact table name, which also fixes clustering keys read from a table whose name differs only by case.
  • P33 ClickHouse: the column type is classified once per column, in both the streaming decoder and the buffered classifier.
  • P29 BigQuery and P32 Cassandra are not in this PR. Review found new defects in each fix, so both went back to main.
Measure Before After
P12, 64 MiB at 200 ms RTT 8.6 s, 7.4 MiB/s 0.68 s, 94 MiB/s
P12, 192 MiB at 200 ms RTT, adjust2 as planned vs the opened window 22.0 s 1.76 s
P12, peak memory with one stalled channel 8.8 MiB 53.5 MiB
P33, decode 2,000,000 cells 512 to 519 ms 184 to 193 ms

Test plan

  • New tests: SSHForwardDestinationTests, SnowflakeShowMetadataTests, SQLStatementRowLimitTests, OracleRowLimitsTests, ClickHouseTabSeparatedRowDecoderTests.
  • OracleRowLimitsTests changes on purpose: the first response now asks for 1,001 rows, not 1,000.
  • P12 measured with the shipped libssh2 against a loopback sshd behind a 200 ms proxy.
  • P13, P30 and P31 did not run against a real Oracle, libSQL or Snowflake server. Their tests cover the options, statements and parsing the drivers use.
  • TableProCore 5,759 tests and TableProOracle 512 tests pass. AllPlugins, the app and the PluginKit ABI check pass, ABI unchanged.
  • The iOS app compiled, but its link and tests did not run here: no simulator runtime on this Mac.

@datlechin
datlechin enabled auto-merge (squash) November 18, 2026 19:33
@datlechin
datlechin merged commit d0989b9 into main Nov 18, 2026
19 of 21 checks passed
@datlechin
datlechin deleted the perf/sql-driver-round-trips branch November 19, 2026 02:00
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.

1 participant