Skip to content

feat(cli): Expose query resource estimates (#1821) - #1821

Open
singcha wants to merge 2 commits into
facebookincubator:mainfrom
singcha:export-D118555659
Open

feat(cli): Expose query resource estimates (#1821)#1821
singcha wants to merge 2 commits into
facebookincubator:mainfrom
singcha:export-D118555659

Conversation

@singcha

@singcha singcha commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary:

Callers can now estimate logical input and output rows and bytes from SQL or an existing logical plan without physical planning or execution. For example, analyzing CREATE TABLE t AS SELECT 1 reports one row entering the table write without creating t.

Parsed statements expose the plan they carry, and wrappers delegate to the wrapped statement. The analysis uses the existing validation path and copies four optional totals from optimizer v2.

Filtered table statistics apply only to analysis. Existing execution and SHOW STATS behavior is unchanged.

Differential Revision: D118555659

@meta-codesync

meta-codesync Bot commented Sep 2, 2026

Copy link
Copy Markdown

@singcha has exported this pull request. If you are a Meta employee, you can view the originating Diff in D118555659.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 2, 2026
Summary:

Extend optimizer-v2 `estimateQueryStats()` with aggregate input-row, input-logical-byte, and output-logical-byte estimates while preserving the existing output-row and column statistics. Input estimates sum scan work after pushdown, include filter-only read columns, scale `TABLESAMPLE SYSTEM`, and become unknown when any scan row count is unknown. `SHOW STATS FOR` continues to consume only the pre-existing fields.

Differential Revision: D118522999
Summary:

Callers can now estimate logical input and output rows and bytes from SQL or an existing logical plan without physical planning or execution. For example, analyzing `CREATE TABLE t AS SELECT 1` reports one row entering the table write without creating `t`.

Parsed statements expose the plan they carry, and wrappers delegate to the wrapped statement. The analysis uses the existing validation path and copies four optional totals from optimizer v2.

Filtered table statistics apply only to analysis. Existing execution and `SHOW STATS` behavior is unchanged.

Differential Revision: D118555659
@meta-codesync meta-codesync Bot changed the title feat(cli): Expose query resource estimates feat(cli): Expose query resource estimates (#1821) Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant