plan-exporter: visualize PostgreSQL EXPLAIN data right from psql
If you love and use psql (like I do), you're equipped with a lot of power. However, when you want to visualize execution plans — using such services as good old explain.depesz.com or modern explain.dalibo.com — you need to deal with inconvenient copy-pasting.
To solve this problem, my colleague Artyom Kartasov has developed a small utility called plan-exporter. It allows sending EXPLAIN data with minimal efforts:
To enable plan-exporter you need to use \o
with a pipe:
After this, psql will start mirroring the output to plan-exporter. When plan-exporter sees the EXPLAIN data, it suggests you sending it to a visualization service.
Both services mentioned above are supported and can be chosen using --target
option. The default is explain.depesz.com.
To reset, just use \o
command without parameters – and plan-exporter
will stop receiving the data. And if you want to always have it enabled when you start psql, consider adjusting your .psqlrc
file: