Skip to content

KXI-70477; Running queries in notebooks is slow as it returns all data instead of having a row limit for the results - #813

Merged
cdinsmore-kx merged 8 commits into
devfrom
KXI-70477
Oct 21, 2026
Merged

cdinsmore-kx merged 8 commits into
devfrom
KXI-70477

Conversation

@cdinsmore-kx

@cdinsmore-kx cdinsmore-kx commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Changes introduced by this PR

  • Row limit settings: adds kdb.notebookRowLimit (default 100) and kdb.notebookRowLimitFrom (first/last, default first). Both are machine-overridable.
  • Notebook toolbar:
    • A row-limit button whose label is the current value. Each preset value (10 to 1,000,000) has its own command, and they all open the same picker; you can also enter a custom whole number.
    • A first/last rows picker.
    • Both buttons are disabled while the active notebook runs on the REPL, which trackNotebookOnRepl tracks through the new runsOnRepl() and onDidChangeActiveTarget.
  • Row limit passed through to execution: it goes from the notebook controller through executeQuery and ConnectionManagementService to both connection types.
    • Local q: sends rowLimit: {size, from}.
    • Insights: sends it as sampleFn/sampleSize instead of the fixed first/10000.
  • formatQ.q: applies the row limit before the TABULAR_LIMIT cut, and the TABULAR_LIMIT cut now takes rows from the same end as the limit. Strings are left whole. count reports the whole result.
  • evaluatePy.q:
    • Applies the row limit the same way for Python.
    • In last mode, a DataFrame with a default index isn an extra key column.
    • A result already cut by the row limit isn't cut again by TABULAR_LIMIT and doesn't warn.
  • Notebook rendering (renderTable):
    • Slices the result itself if the process ignored t
    • Numbers last rows from the end of the whole result.
    • Adds a footer such as "Showing first 100 of 25,000 rows", with numbers always in en-US.
    • String results get no footer.
  • Results panel CSV: notebook outputs would silently replace the csv export data - separate bug but now fixed.
  • Docs: docs/user/reference-card.md lists the new commands and settings and has a short note on notebook row limits. sts:
    • Unit tests for the connections, workspace command, connection manager, notebook controller (including string footers and en-US formatting), provider and toolbar, and the result
    • The palette command list in commands.test.ts now includes the two new commands.
    • q tests in formatQ.quke and evaluatePy.quke.
    • An e2e test (rowLimit.test.ts) with local, Insights and REPL notebooks, plus row-limit support in the q and Insights stand-in servers.

@cdinsmore-kx cdinsmore-kx self-assigned this Oct 20, 2026
@cdinsmore-kx
cdinsmore-kx marked this pull request as ready for review October 20, 2026 17:35
ecmel
ecmel previously approved these changes Oct 21, 2026
@kx-sonarqube

kx-sonarqube Bot commented Oct 21, 2026

Copy link
Copy Markdown

@cdinsmore-kx
cdinsmore-kx requested a review from ecmel October 21, 2026 13:48
@cdinsmore-kx
cdinsmore-kx merged commit be996a9 into dev Oct 21, 2026
8 checks passed
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