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

sql: always collect stats after a table is created #37611

Merged
merged 1 commit into from
May 21, 2019

Conversation

rytaft
Copy link
Collaborator

@rytaft rytaft commented May 20, 2019

Prior to this commit, we only collected automatic statistics on a
CREATE TABLE statement if it was of the form CREATE TABLE AS <query>.
To avoid inconsistencies, this commit changes the logic so we always
create statistics on every successful CREATE TABLE statement.

Fixes #37362

Release note (sql change): CREATE TABLE statements now always trigger automatic
statistics collection on the newly created table.

@rytaft rytaft requested review from justinj, RaduBerinde and a team May 20, 2019 20:48
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@rytaft rytaft requested a review from a team May 20, 2019 21:11
Copy link
Member

@RaduBerinde RaduBerinde left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @justinj and @RaduBerinde)

Copy link
Contributor

@justinj justinj left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: :shipit: complete! 2 of 0 LGTMs obtained (waiting on @justinj)

Prior to this commit, we only collected automatic statistics on a
CREATE TABLE statement if it was of the form CREATE TABLE AS <query>.
To avoid inconsistencies, this commit changes the logic so we always
create statistics on every successful CREATE TABLE statement.

Fixes cockroachdb#37362

Release note (sql change): CREATE TABLE statements now always trigger automatic
statistics collection on the newly created table.
@rytaft
Copy link
Collaborator Author

rytaft commented May 21, 2019

TFTRs!

bors r+

craig bot pushed a commit that referenced this pull request May 21, 2019
37611: sql: always collect stats after a table is created r=rytaft a=rytaft

Prior to this commit, we only collected automatic statistics on a
`CREATE TABLE` statement if it was of the form `CREATE TABLE AS <query>`.
To avoid inconsistencies, this commit changes the logic so we always
create statistics on every successful `CREATE TABLE` statement.

Fixes #37362

Release note (sql change): CREATE TABLE statements now always trigger automatic
statistics collection on the newly created table.

Co-authored-by: Rebecca Taft <[email protected]>
@craig
Copy link
Contributor

craig bot commented May 21, 2019

Build succeeded

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.

table stats: automatic statistics on empty tables in some cases but not others
4 participants