-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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: statement bundles with expression indexes should have reproducible stats #68184
Comments
As of #68312, we no longer collect statistics for inaccessible virtual columns that back expression indexes. If that changes, we'll need to address this issue. For now, I'll move this to the backlog. |
Previous, an `ALTER TABLE ... INJECT STATS` command would return an error if the given stats JSON included any columns that were not present in the table descriptor. Statistics in statement bundles often include dropped columns, so reproducing issues with a bundle required tediously removing stats for these columns. This commit changes the stats injection behavior so that a notice is issued for stats with non-existent columns rather than an error. Any stats for existing columns will be injected successfully. Informs cockroachdb#68184 Release note (sql change): `ALTER TABLE ... INJECT STATISTICS ...` will now issue notices when the given statistics JSON includes non-existent columns, rather than resulting in an error. Any statistics in the JSON for existing columns in be inject successfully.
Previously, an `ALTER TABLE ... INJECT STATS` command would return an error if the given stats JSON included any columns that were not present in the table descriptor. Statistics in statement bundles often include dropped columns, so reproducing issues with a bundle required tediously removing stats for these columns. This commit changes the stats injection behavior so that a notice is issued for stats with non-existent columns rather than an error. Any stats for existing columns will be injected successfully. Informs cockroachdb#68184 Release note (sql change): `ALTER TABLE ... INJECT STATISTICS ...` will now issue notices when the given statistics JSON includes non-existent columns, rather than resulting in an error. Any statistics in the JSON for existing columns will be injected successfully.
78997: sql: ignore non-existent columns when injecting stats r=mgartner a=mgartner Previously, an `ALTER TABLE ... INJECT STATS` command would return an error if the given stats JSON included any columns that were not present in the table descriptor. Statistics in statement bundles often include dropped columns, so reproducing issues with a bundle required tediously removing stats for these columns. This commit changes the stats injection behavior so that a notice is issued for stats with non-existent columns rather than an error. Any stats for existing columns will be injected successfully. Informs #68184 Release note (sql change): `ALTER TABLE ... INJECT STATISTICS ...` will now issue notices when the given statistics JSON includes non-existent columns, rather than resulting in an error. Any statistics in the JSON for existing columns will be injected successfully. Co-authored-by: Marcus Gartner <marcus@cockroachlabs.com>
Previously, an `ALTER TABLE ... INJECT STATS` command would return an error if the given stats JSON included any columns that were not present in the table descriptor. Statistics in statement bundles often include dropped columns, so reproducing issues with a bundle required tediously removing stats for these columns. This commit changes the stats injection behavior so that a notice is issued for stats with non-existent columns rather than an error. Any stats for existing columns will be injected successfully. Informs #68184 Release note (sql change): `ALTER TABLE ... INJECT STATISTICS ...` will now issue notices when the given statistics JSON includes non-existent columns, rather than resulting in an error. Any statistics in the JSON for existing columns will be injected successfully.
Previously, an `ALTER TABLE ... INJECT STATS` command would return an error if the given stats JSON included any columns that were not present in the table descriptor. Statistics in statement bundles often include dropped columns, so reproducing issues with a bundle required tediously removing stats for these columns. This commit changes the stats injection behavior so that a notice is issued for stats with non-existent columns rather than an error. Any stats for existing columns will be injected successfully. Informs #68184 Release note (sql change): `ALTER TABLE ... INJECT STATISTICS ...` will now issue notices when the given statistics JSON includes non-existent columns, rather than resulting in an error. Any statistics in the JSON for existing columns will be injected successfully.
Previously, an `ALTER TABLE ... INJECT STATS` command would return an error if the given stats JSON included any columns that were not present in the table descriptor. Statistics in statement bundles often include dropped columns, so reproducing issues with a bundle required tediously removing stats for these columns. This commit changes the stats injection behavior so that a notice is issued for stats with non-existent columns rather than an error. Any stats for existing columns will be injected successfully. Informs #68184 Release note (sql change): `ALTER TABLE ... INJECT STATISTICS ...` will now issue notices when the given statistics JSON includes non-existent columns, rather than resulting in an error. Any statistics in the JSON for existing columns will be injected successfully.
Previously, an `ALTER TABLE ... INJECT STATS` command would return an error if the given stats JSON included any columns that were not present in the table descriptor. Statistics in statement bundles often include dropped columns, so reproducing issues with a bundle required tediously removing stats for these columns. This commit changes the stats injection behavior so that a notice is issued for stats with non-existent columns rather than an error. Any stats for existing columns will be injected successfully. Informs cockroachdb#68184 Release note (sql change): `ALTER TABLE ... INJECT STATISTICS ...` will now issue notices when the given statistics JSON includes non-existent columns, rather than resulting in an error. Any statistics in the JSON for existing columns will be injected successfully.
We have marked this issue as stale because it has been inactive for |
Expression indexes are implemented using inaccessible virtual computed columns. These columns are not shown shown in the
schema.sql
file of a statement bundle. But they are included in thestats-*.sql
files.When the
schema.sql
file is executed to try to reproduce a customer issue, the names of these inaccessible columns are dependent on the order of their associated indexes. This means that the names of the columns can be different from what they were in the customer's schema. This can create cases where the inaccessible columns' statistics refer to the wrong columns.For example, suppose a customer created the following table and collected a statement bundle:
The statement bundle would include a
schema.sql
like this:And a statistics file like this (I've abbreviated it here):
Note that the statistics list the type of
crdb_internal_idx_expr_1
asBOOL
. However, when you executeschema.sql
, thecrdb_internal_idx_expr_1
column is the virtual column backingi3
'sa + 100:::INT8
expression:This will make debugging statement bundles that have expression indexes hard to debug. It will not be clear when the column names do not line up, and will likely lead to confusion when a customer issue cannot be reproduced with the statement bundle.
One proposed solution: for the statement bundle
schema.sql
file only, list the inaccessible columns as hidden virtual columns and print these column names as the index elements of expression indexes rather than their expression.Jira issue: CRDB-8919
Epic CRDB-14510
The text was updated successfully, but these errors were encountered: