ktx/packages/cli
Mayorkun Ayanshina 18245c2373
feat(mysql): implement columnStats using INFORMATION_SCHEMA.STATISTICS (#233)
* feat(mysql): implement columnStats using INFORMATION_SCHEMA.STATISTICS

Enable column cardinality statistics for the MySQL connector by querying
INFORMATION_SCHEMA.STATISTICS, which provides index-based cardinality
estimates without requiring additional permissions.

- Add generateColumnStatisticsQuery() to KtxMysqlDialect
- Add getColumnStatistics() and columnStats() to KtxMysqlScanConnector
- Flip columnStats capability from false to true
- Add MysqlStatsRow and KtxMysqlColumnStatisticsResult interfaces
- Add tests for dialect query generation and connector stats retrieval
- Update dialect conformance fixture for mysql

* fix(mysql): filter to leading index columns to avoid inflated cardinality

Add AND SEQ_IN_INDEX = 1 to INFORMATION_SCHEMA.STATISTICS query to
ensure only leading index columns are returned. For composite indexes,
non-leading columns report the cardinality of the index prefix rather
than the column's own distinct count, which inflates distinctCount.

Add regression test asserting SEQ_IN_INDEX = 1 is present in the query.

* fix: add trailing newline to dialect.test.ts

---------

Co-authored-by: Andrey Avtomonov <andreybavt@gmail.com>
2026-06-08 12:21:19 +02:00
..
assets/demo/orbit Polish documentation copy (#98) 2026-05-14 12:43:14 -04:00
scripts chore(workspace): gate dead-code with knip production mode (#196) 2026-05-21 15:28:58 +02:00
src feat(mysql): implement columnStats using INFORMATION_SCHEMA.STATISTICS (#233) 2026-06-08 12:21:19 +02:00
test feat(mysql): implement columnStats using INFORMATION_SCHEMA.STATISTICS (#233) 2026-06-08 12:21:19 +02:00
package.json docs: minor README and docs-site touch-ups (#266) 2026-06-06 22:32:08 -04:00
tsconfig.json chore(workspace): gate dead-code with knip production mode (#196) 2026-05-21 15:28:58 +02:00
tsconfig.test.json test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00
vitest.config.ts test: split cli tests from source tree (#216) 2026-05-26 08:49:05 +02:00