Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage the statistics target for a deployment #4092

Merged
merged 4 commits into from
Nov 23, 2022
Merged

Conversation

lutter
Copy link
Collaborator

@lutter lutter commented Oct 22, 2022

Show, set or reset the target for a deployment. The statistics target determines how much of a table Postgres will sample when it analyzes a table. This can be particularly beneficial when Postgres chooses suboptimal query plans for some queries. Increasing the target will make analyzing tables take longer and will require more space in Postgres' internal statistics storage.

See also https://www.postgresql.org/docs/15/planner-stats.html#id-1.5.13.5.3

@lutter lutter force-pushed the lutter/stats-target branch from 0637ce0 to 36a3bcf Compare October 24, 2022 15:32
@lutter lutter self-assigned this Oct 24, 2022
@evaporei evaporei requested a review from tilacog October 27, 2022 15:42
Comment on lines 165 to 170
impl Borrow<str> for SqlName {
fn borrow(&self) -> &str {
self.as_str()
}
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to implement Borrow<str> for SqlName, only for &SqlName.

Suggested change
impl Borrow<str> for SqlName {
fn borrow(&self) -> &str {
self.as_str()
}
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch. Taking that out.

Comment on lines +187 to +191
let columns = if columns.is_empty() {
vec!["id".to_string(), "block_range".to_string()]
} else {
columns
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two questions:

  1. Should id and block_range always be included?
  2. What about vid?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't seen vid be useful here, that's why I left it out. And I felt that not adding to a list of user-provided columns is more understandable than always adding them.

Copy link
Contributor

@tilacog tilacog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I just left a few questions, but everything looks fine.

@lutter lutter force-pushed the lutter/stats-target branch from 36a3bcf to 9435720 Compare November 23, 2022 19:26
@lutter lutter merged commit 9435720 into master Nov 23, 2022
@lutter lutter deleted the lutter/stats-target branch November 23, 2022 19:33
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