-
Notifications
You must be signed in to change notification settings - Fork 320
perf: Improve getKeyValues query performance for JSON keys #1284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 23f37db The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Review: getKeyValues Performance OptimizationPerformance Improvement: ✅ Excellent optimization - 34x speedup (15.03s → 0.443s) Code Quality: ✅ Well-structured with comprehensive integration tests Critical IssuesNone found - this is a solid optimization. Minor ObservationsIntegration Test Cleanup:
Test Coverage:
Code Change Summary:
CI Configuration:
RecommendationLGTM with one minor fix - Add client cleanup in the integration test |
E2E Test Results✅ All tests passed • 26 passed • 3 skipped • 236s
|
d2aaa67 to
b332faa
Compare
b332faa to
4c54135
Compare
4c54135 to
5c6327b
Compare
5c6327b to
1d8c5f0
Compare
1d8c5f0 to
3297abd
Compare
| const selectClause = keys | ||
| .map((k, i) => `groupUniqArray(${limit})(${k}) AS param${i}`) | ||
| .join(', '); | ||
| if (keys.length === 0) return []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the functional changes are in this file.
This check was added because previously, the query would generate an empty select clause when no keys were provided, resulting in a query error. (eg. SELECT FROM table...)
3297abd to
23f37db
Compare
Closes HDX-2623
Summary
This change improves the performance of
getKeyValueswhen getting values of a JSON key.Generally, columns that are not referenced outside of a CTE will be pruned by the query planner. For JSON however, if the outer select references one field in a JSON column, then the inner select will read (it seems) the entire JSON object.
This PR also adds integration tests for
getKeyValuesto ensure that the function generates queries that work as expected in ClickHouse.Performance impact (on single JSON Dashboard Filter)