sqlc-dev / sqlc

Generate type-safe code from SQL
https://sqlc.dev
MIT License
13.58k stars 812 forks source link

[DRAFT] add raw explain #3581

Open rucciva opened 2 months ago

rucciva commented 2 months ago

Hello, i would like to propose the addition of new command that simply output yaml containing the result of running EXPLAIN, where each items contains the query, the arguments used when explain, and the raw output.

My motivation are:

  1. CMIIW, the current cel can't provide full assertion since the json output of explain has varying depths based on the query, meanwhile cel can't do dynamic recursion
  2. if we simply output the explain result, we could combine it with other tools, thus the assertion of query explain can be very dynamic

I think the detailed functionality of this subcommand might need further improvement, e.g. whether to allow specifying options to EXPLAIN query or whether we should parse the explain result if it is a formatted (json) output,so feedback are very welcome.