You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed the following behavior: if I create two empty tables, I don't get any statistics for them. But then if I create an index for one of them, that table does get statistics. At this point we have one table with statistics (which show 0 rows) and one without statistics (for which we assume 1000 rows). This leads to unexpected plans (e.g. lookup joins).
I am not sure if this is only a problem with empty tables, or also with tables that are small enough to not trigger the collection.
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.
Fixescockroachdb#37362
Release note (sql change): CREATE TABLE statements now always trigger automatic
statistics collection on the newly created table.
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]>
I noticed the following behavior: if I create two empty tables, I don't get any statistics for them. But then if I create an index for one of them, that table does get statistics. At this point we have one table with statistics (which show 0 rows) and one without statistics (for which we assume 1000 rows). This leads to unexpected plans (e.g. lookup joins).
I am not sure if this is only a problem with empty tables, or also with tables that are small enough to not trigger the collection.
CC @awoods187
The text was updated successfully, but these errors were encountered: