cockroachdb / cockroachdb/cockroach

Allow EXPLAIN to be run against REFRESH MATERIALIZED VIEW

Open
#97,809 0 comments 0 reactions 0 assignees View on GitHub
A-sql-explain C-enhancement T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

**Is your feature request related to a problem? Please describe.**
I'm having trouble refreshing data on an MV. While troubleshooting, I'm not allowed to do an "EXPLAIN ANALYZE(DEBUG) REFRESH MATERIALIZED VIEW ..."

```
root@localhost:26257/defaultdb> explain refresh materialized view x;
invalid syntax: statement ignored: at or near "refresh": syntax error
SQLSTATE: 42601
DETAIL: source SQL:
explain refresh materialized view x
^
HINT: try \h EXPLAIN

root@localhost:26257/defaultdb> \h explain;
Command: EXPLAIN
Description: show the logical plan of a query
Category: miscellaneous
Syntax:
EXPLAIN
EXPLAIN ([PLAN ,] )
EXPLAIN (DISTSQL)
EXPLAIN ANALYZE [(DISTSQL)]
EXPLAIN ANALYZE (PLAN )

Explainable statements:
SELECT, CREATE, DROP, ALTER, INSERT, UPSERT, UPDATE, DELETE,
SHOW, EXPLAIN

Plan options:
TYPES, VERBOSE, OPT

See also:
https://www.cockroachlabs.com/docs/v22.2/explain.html
```

**Describe the solution you'd like**
I think EXPLAIN should work on REFRESH statements.

**Describe alternatives you've considered**
-none-

**Additional context**
Running on CRDB 22.2.5

Jira issue: CRDB-24896

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.