materialize icon indicating copy to clipboard operation
materialize copied to clipboard

[Epic] sql: formalize output of `SHOW` commands

Open sploiselle opened this issue 3 years ago • 5 comments

Work items

  • [x] #14639
  • [x] #14642
  • [x] #14643
  • [x] #14644
  • [x] #14646
  • [x] #12700
  • [ ] #14647
  • [x] #14648
  • [x] #14547
  • [ ] #14649
  • [x] #14876
  • [x] #14727

Background and rationale

From @benesch in #11190:

Platform is a good opportunity to revisit the SHOW commands en masse and tailor them to our liking, rather than the Franken-MySQL we've got right now.

The SHOW commands are a MySQL-ism that CockroachDB borrowed, despite largely providing a PG-alike API, and we have largely followed suit. However, as Materialize develops we have extended our SHOW commands to provide access to dimensions specific to Materialize, e.g. SINKS, IN CLUSTER.

Before we ship platform, we'd like to firm up the output of these commands to ensure some kind of consistent reasoning about their output (at the very least--thinking about their input might be good, as well) so we can make rote decisions about any extensions we need to make in the future.

Tagging this as A-sql because the show commands are manifest in SQL planning code, but thinking about the structure of what the output should be is likely a more cross-cutting concern because it involves an expression of how each class of object wants to present itself. The SQL team likely wants to get e.g. sources and sink's feedback about how sources and sinks want to handle SHOW SOURCES etc.

Work items by statement

  • SHOW DATABASES is in good shape.
  • SHOW SCHEMAS is in good shape, modulo #14642.
  • SHOW CONNECTIONS: #14643.
  • SHOW TABLES is in good shape. Columns are described by SHOW COLUMNS.
  • SHOW VIEWS same as SHOW TABLES.
  • SHOW MATERIALIZED VIEWS: #14648.
  • SHOW OBJECTS: #14644.
  • SHOW SOURCES: #14647.
  • SHOW SINKS same as SHOW SOURCES.
  • SHOW TYPES is in good shape, modulo #14642.
  • SHOW INDEXES: #12700.
  • SHOW COLUMNS: #14646
  • SHOW CLUSTERS is in good shape.
  • SHOW CLUSTER REPLICAS needs information about size and availability zone.
  • SHOW SECRETS is in good shape.

sploiselle avatar Mar 15 '22 12:03 sploiselle

One request here: all SHOW commands are sql syntax sugar for a regular SELECT over a system table. This allows folks to use subqueries and otherwise modify these results with general SQL.

Editor's note: this has been filed as #14547.

maddyblue avatar Mar 23 '22 16:03 maddyblue

We should absolutely do this, but I'm not totally convinced that it's a platform blocker. @sploiselle or @benesch - would you mind giving more context on the priority here?

JLDLaughlin avatar Jul 14 '22 20:07 JLDLaughlin

@JLDLaughlin The idea behind labeling this as a platform blocker was codifying the shape of these queries to prevent easy-to-avoid breaking changes, i.e. the release of platform should have a stable API, i.e. provides a contract with users that they can build tooling on top of MZ without regular breakage.

sploiselle avatar Jul 14 '22 21:07 sploiselle

@chaas @ggnall I broke this issue down into bite-sized work items, all linked in the description. I'm not sure what protocol is for prioritization and tracking—should each of these issues be marked for triage separately? Should each get added to the SQL project board? Or should we just track this meta issue? I figured I'd leave it to you two to sort out, if that works!

benesch avatar Sep 05 '22 22:09 benesch

Wow thanks @benesch ! Really appreciate you taking the time to think this out. Graham is OOO the next two weeks, so I'll be handling solo. For prioritization and high-level tracking the epic level is fine. Once implementation begins, we can track the tickets' progress via the board to ensure multiple people don't implement the same change if we have more than one person working on it.

chaas avatar Sep 06 '22 13:09 chaas

Unsure whether this is something legit to expose, but AFAICT we don't make source or replica sizes available anywhere. How would one check the current size of a source, or the size of each replica in a cluster? For sources, this information is probably accessible through SHOW CREATE SOURCE, though that's not the most ergonomic way to check for size.

Edit: Just noticed that this is already laid out for SHOW CLUSTER REPLICAS!

morsapaes avatar Sep 26 '22 12:09 morsapaes

This is done! The only thing outstanding is #14649, which we're not planning to tackle now. All the commands are documented on their own pages currently.

chaas avatar Sep 30 '22 13:09 chaas