Skip to content

fix: skip row limit enforcement for EXPLAIN queries#8888

Open
VishakBaddur wants to merge 3 commits intomarimo-team:mainfrom
VishakBaddur:fix/explain-query-truncated-by-limit
Open

fix: skip row limit enforcement for EXPLAIN queries#8888
VishakBaddur wants to merge 3 commits intomarimo-team:mainfrom
VishakBaddur:fix/explain-query-truncated-by-limit

Conversation

@VishakBaddur
Copy link
Copy Markdown
Contributor

Fixes #8328

Root Cause

EXPLAIN queries were being truncated to the default result limit (e.g. 10 rows) before the EXPLAIN-specific display logic ran.

enforce_own_limit was True for EXPLAIN queries, so df.limit() / df.head() truncated the dataframe first. Then extract_explain_content() only saw the truncated data — and since plain_text() has no pagination, users had no way to scroll through the full output.

Fix

One-line change: add not is_explain_query(query) to the enforce_own_limit condition:

enforce_own_limit = not has_limit and default_result_limit is not None and not is_explain_query(query)

EXPLAIN queries now bypass the row limit entirely, so all rows are passed to extract_explain_content().

Testing

Added test_explain_query_not_truncated_by_limit to tests/_sql/test_duckdb.py: verifies that EXPLAIN output is not truncated when MARIMO_SQL_DEFAULT_LIMIT is set.

Fixes marimo-team#8328

EXPLAIN queries were being truncated to the default result limit
(e.g. 10 rows) before the EXPLAIN-specific display logic ran.
This meant extract_explain_content() only saw the truncated data,
and users had no way to scroll through the full EXPLAIN output.

Fix: add not is_explain_query(query) to the enforce_own_limit
condition so EXPLAIN queries bypass the row limit entirely.
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment Mar 26, 2026 10:50pm

Request Review

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 26, 2026

Bundle Report

Bundle size has no change ✅

Affected Assets, Files, and Routes:

view changes for bundle: marimo-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/dist-*.js 67 bytes 169 bytes 65.69% ⚠️
assets/dist-*.js 122 bytes 259 bytes 89.05% ⚠️
assets/dist-*.js 175 bytes 335 bytes 109.38% ⚠️
assets/dist-*.js 131 bytes 387 bytes 51.17% ⚠️
assets/dist-*.js -6 bytes 177 bytes -3.28%
assets/dist-*.js 99 bytes 276 bytes 55.93% ⚠️
assets/dist-*.js -250 bytes 137 bytes -64.6%
assets/dist-*.js -157 bytes 102 bytes -60.62%
assets/dist-*.js 33 bytes 137 bytes 31.73% ⚠️
assets/dist-*.js 227 bytes 403 bytes 128.98% ⚠️
assets/dist-*.js 7 bytes 176 bytes 4.14%
assets/dist-*.js -220 bytes 183 bytes -54.59%
assets/dist-*.js -33 bytes 104 bytes -24.09%
assets/dist-*.js -65 bytes 104 bytes -38.46%
assets/dist-*.js 92 bytes 256 bytes 56.1% ⚠️
assets/dist-*.js 56 bytes 160 bytes 53.85% ⚠️
assets/dist-*.js -107 bytes 169 bytes -38.77%
assets/dist-*.js -171 bytes 164 bytes -51.04%
assets/__vite-*.js -5 bytes 93 bytes -5.1%
assets/__vite-*.js 5 bytes 98 bytes 5.38% ⚠️

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.

Explain SQL-Statement previews rows with no chance to scroll

1 participant