Skip to content

Add opt-in optimizer statistics gathering after builds - #202

Closed
igvog wants to merge 1 commit into
oracle:mainfrom
igvog:feature/gather-table-statistics
Closed

igvog wants to merge 1 commit into
oracle:mainfrom
igvog:feature/gather-table-statistics

Conversation

@igvog

@igvog igvog commented Sep 26, 2026

Copy link
Copy Markdown

Summary

  • Add a gather_statistics config that runs DBMS_STATS.GATHER_TABLE_STATS after table, incremental, snapshot, and seed builds.
  • Leave the setting off by default so existing runs stay unchanged.
  • Accept estimate_percent, method_opt, degree, and cascade when the config is a dictionary.

Test plan

  • Run pytest tests/functional/adapter/test_gather_statistics.py against ADB Free.
  • Build a table with gather_statistics set to a method_opt of FOR ALL COLUMNS SIZE 1 and confirm ALL_TAB_COL_STATISTICS shows a one-bucket FREQUENCY histogram.
  • Run an incremental model twice after deleting its stats and confirm NUM_ROWS refreshes only when gather_statistics is enabled.
  • Confirm a model with gather_statistics: 'yes' fails with a config error.

Made with Cursor

CREATE TABLE AS SELECT and incremental merges leave Oracle tables without refreshed stats, so downstream plans use defaults until DBMS_STATS is run by hand.

Co-authored-by: Cursor <cursoragent@cursor.com>
@oracle-contributor-agreement

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
The following contributors of this PR have not signed the OCA:

To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application.

When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated.

If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public.

@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. label Sep 26, 2026
@igvog igvog closed this Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Required At least one contributor does not have an approved Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant