Created
April 21, 2023 03:20
-
-
Save marcomalva/75c3967372a94cc4ae146afa135da1b6 to your computer and use it in GitHub Desktop.
[Visualize PostgreSQL Query Plan Locally With Pev2] Basic Instructions #psql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- https://github.com/dalibo/pev2 | |
-- | |
-- Save the query as an SQL file and paste the JSON file into the index.html | |
-- | |
-- Download the index.html page with the command below and open it in your web browser: | |
-- wget https://www.github.com/dalibo/pev2/releases/latest/download/index.html | |
-- | |
-- Obtain the database query plan with command below: | |
-- psql -h ${DB_HOST:-localhost} -p ${DB_PORT:-5432} -U ${DB_USER:-db_user} -XqAt -f "${filename}" > "analyze-${filename%.*}.json" | |
-- | |
EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS, FORMAT JSON) | |
SELECT * FROM your_table; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment