SKalt / postgres_explain_analyze_json_schema

a JSON schema for postgres EXPLAIN output

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

postgres_explain_analyze_json_schema

a JSON schema for postgres ``EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS)` yaml or json.

Methodology

Unfortunately, the schema is hand-maintained.

  1. I generated many the output of many EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS, FORMAT YAML) queries in pg_inventory
  2. an initial skeleton of the schema was generated with the python genson package using ./scripts/generate_initial_schema.py,
  3. guessing which string types have constrained values, (i.e. any key ending in " Type:"), I used ./scripts/collect_enums.sh to generate enumeration values and hand-defined the enumerations
  4. I extracted a definition of a Plan object and used it to recursively define itself
  5. I transformed the JSON into the primary document, schema.yaml using ./scripts/to_yaml.py
  6. I test the definition against the corpus of YAML I have using ./scripts/validate_schema_against_corpus.py.
  7. Re-transform schema.yaml into schema.json for easier distribution

About

a JSON schema for postgres EXPLAIN output

License:Apache License 2.0


Languages

Language:Python 89.6%Language:Shell 10.4%