Repository navigation
[Postgres] Collect column statistics by default - #26015
sangeetashivaji wants to merge 5 commits into
Conversation
collect_column_statistics.enabled now defaults to true, so every DBM Postgres instance collects pg_stats summaries without extra config. As an opt-in setting it was rarely enabled. Collection still needs the datadog.column_statistics() function in each database. Before reading it, the collector now checks for the function with to_regprocedure. A database without it is skipped with the same one-time warning and column_statistics_function_not_found health event as before, but without running a failing query, so instances that never set the function up don't get an hourly ERROR in their Postgres logs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
|
✅ Dispatcher tests: passed
✅ 38 passed · nothing failed Batches · ✅ batch-01 38/38 Dispatcher finished on |
evalya-impact-summaryEvalya CI impact |
🎉 All green!🧪 All tests passed 🔄 Datadog retried 1 test - 1 passed on retry 🎯 Code Coverage (details) 🔗 Commit SHA: 0fedf0e | Docs | View more details | Give us feedback! |
Disk usage changeCommit Uncompressed
Details
Compressed
Details
|
Adds collect_column_statistics.function (default datadog.column_statistics), matching query_samples.explain_function, so the function can live in another schema. The name is validated when the config loads: a function name of letters, digits and underscores, optionally schema-qualified, with an optional trailing "()". Anything else is a configuration error. It is quoted before it reaches SQL. The collector, the existence check, agent diagnose, the warning logs and the remediation text all use the configured name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fb0e4bcdd2
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| @@ -0,0 +1 @@ | |||
| Collect column statistics by default, and add the `collect_column_statistics.function` option to override the function used to read them. | |||
There was a problem hiding this comment.
Classify the default-on behavior as a breaking change
Rename this entry to 26015.changed: changing collect_column_statistics.enabled from false to true causes existing DBM instances to start emitting column-statistics data without a configuration change, which is exactly the repository's stated case for a backward-incompatible .changed entry. Leaving this as .added produces a minor release instead of the required major version bump.
AGENTS.md reference: AGENTS.md:L240-L244
Useful? React with 👍 / 👎.
| assert check._config.collect_column_statistics.enabled | ||
| assert check.metadata_samples._column_statistics_collector is not None |
There was a problem hiding this comment.
Verify the observable default-on collection behavior
Replace these private-state assertions with a boundary-level assertion that omitting collect_column_statistics actually executes collection or emits a column-statistics event. This test still passes if the collector is constructed but never scheduled or run, so it does not protect the user-visible behavior claimed by the change and duplicates the configuration-default coverage.
AGENTS.md reference: AGENTS.md:L197-L205
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
More details
No reportable defect was found in the missing-function skip path or configurable function handling. Confidence is limited to static review and unit-level validation; live PostgreSQL integration behavior remains unverified.
🤖 Bits Code Review · Commit fb0e4bc
…est it end to end Default-on collection changes emitted data for existing DBM instances, which AGENTS.md classes as a changed entry, so the default flip is 26015.changed and the new function option is 26015.added. The default-on test now runs the check with no collect_column_statistics section and asserts column statistics events are emitted, instead of checking the collector object. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Validation ReportAll 22 validations passed. Show details
|
What does this PR do?
collect_column_statistics.enabled: true). It still requiresdbm: true.datadog.column_statistics()function exists before calling it. Databases without it are skipped with the existing one-time warning and health event, and no failing query appears in the Postgres logs.collect_column_statistics.functionto use a function in a different schema, likequery_samples.explain_function. Invalid names are rejected when the config loads.Motivation
Column statistics help Database Monitoring reason about query plans, but as an opt-in setting they are rarely enabled. With this change, creating the function is the only setup step.
Checklist before requesting review
changedentry (it changes emitted data for existing instances), and the new option isadded. The default-on test now checks emitted events.🤖 Generated with Claude Code