Back to Code Snippets


Open the HTML version of an EXPLAIN statementBash

DuckDB can output the plan in different ways, e.g. HTML or JSON. It's hard to easily view this when in the DuckDB CLI, but in non-interactive mode we can pass the result to a HTML file directly and open it.

Execute this Bash

duckdb my_complex_db.duckdb -c "                                                                                                                                                         
EXPLAIN  (ANALYZE, FORMAT html)
INSERT INTO big_data.complex_db
    (key_to_update, values, event_time)
SELECT
    key_to_update, values, event_time
FROM big_data.new_data
WHERE event_time >= '2026-01-01'::date
" > output.html && open output.html

Copy code

Dumky de Wilde

Expand

Share link