cockroachdb / cockroachdb/cockroach

sql: show-stats doesn't work when the table is offline

Open
#108,579 1 comment 0 reactions 0 assignees View on GitHub
A-sql-table-stats C-enhancement T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

While an import job is running, the table is taken offline to prevent concurrent access. The SHOW STATISTICS command attempts to retrieve the table descriptor in order to check privileges and use table ID for the stats lookup. This is done through `ResolveUncachedTableDescriptorEx`, which returns an error when it finds an offline table. This is a poor user experience since it's unexpected that an import would conflict with viewing stats that were previously gathered. We should consider whether it's possible to change this behavior for SHOW STATISTICS and similar commands. At first glance it seems like this should be possible, since the table is not mutated, nor is its data read.

Reproduction is simple - just attempt to use the `SHOW STATISTICS` command on a table while an import job is running.

Jira issue: CRDB-30526

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.