Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/skalt/postgres_explain_analyze_json_schema
a JSON schema for postgres EXPLAIN output
https://github.com/skalt/postgres_explain_analyze_json_schema
explain-plan explain-sql json-schema postgres postgresql
Last synced: 5 days ago
JSON representation
a JSON schema for postgres EXPLAIN output
- Host: GitHub
- URL: https://github.com/skalt/postgres_explain_analyze_json_schema
- Owner: SKalt
- License: apache-2.0
- Created: 2022-06-05T16:18:58.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-21T12:48:03.000Z (9 months ago)
- Last Synced: 2024-10-27T07:52:25.816Z (about 2 months ago)
- Topics: explain-plan, explain-sql, json-schema, postgres, postgresql
- Language: Python
- Homepage:
- Size: 451 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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`](https://github.com/SKalt/pg_inventory)
1. an initial skeleton of the schema was generated with [the python `genson` package](https://github.com/wolverdude/GenSON/) using [`./scripts/generate_initial_schema.py`](./scripts/generate_initial_schema.py),
1. guessing which string types have constrained values, (i.e. any key ending in " Type:"), I used [`./scripts/collect_enums.sh`](./scripts/collect_enums.sh) to generate enumeration values and hand-defined the enumerations
1. I extracted a definition of a `Plan` object and used it to recursively define itself
1. I transformed the JSON into the primary document, [`schema.yaml`](./schema.yaml) using [`./scripts/to_yaml.py`](./scripts/to_yaml.py)
1. I test the definition against the corpus of YAML I have using [`./scripts/validate_schema_against_corpus.py`](./scripts/validate_schema_against_corpus.py).
1. Re-transform [`schema.yaml`](./schema.yaml) into [`schema.json`](./schema.json) for easier distribution