A TablePlus plugin that provides visual explain plan visualization for PostgreSQL queries using PEV2.
- Visualize PostgreSQL EXPLAIN plans using PEV2
- Support for PostgreSQL's JSON explain format
- Interactive visualization with detailed node information
- Query display alongside the plan
- Download the latest release from the releases page.
- Double-click the
.tablepluspluginfile to install it in TablePlus. - Restart TablePlus if necessary.
- Connect to a PostgreSQL database in TablePlus.
- Write or select a SQL query in the query editor.
- Press
Ctrl+E(orCmd+Eon macOS) or select "Visual Explain SQL" from the context menu. - The visual explain plan will be displayed in a new window.
The plugin executes the following SQL commands when you run it:
SELECT VERSION() as version- To get the PostgreSQL versionEXPLAIN (FORMAT JSON) YOUR_QUERY- To get the explain plan in JSON format
The JSON explain plan is then visualized using the PEV2 library, which provides an interactive visualization of the plan.
- Node.js (v21 or later)
- npm
-
Clone the repository:
git clone https://github.com/jorgemarizan/tableplus-pg-visual-explain.git cd tableplus-pg-visual-explain -
Install dependencies:
npm install -
Build the plugin:
npm run build -
Package the plugin:
npm run package -
The packaged plugin will be in
PgVisualExplain.tableplusplugin.zip.
plugin/- Contains the TypeScript files for the TablePlus plugin logicui/- Contains the Vue.js components and UI logicdist/- Contains the compiled JavaScript files (generated after build)tests/- Contains test files for verifying the plugin.github/workflows/- Contains GitHub Actions workflow files for CI/CD
This project uses GitHub Actions to automatically build and release the plugin. Every time a commit is pushed to the main branch, the workflow will:
- Build the plugin
- Package it into a
.tableplusplugin.zipfile - Create a GitHub release with the packaged plugin attached
The release is automatically tagged and named using the version from package.json combined with the commit SHA. No manual tagging is required - just push your changes to the main branch, and a new release will be created automatically.
All releases will appear on the releases page.
To test the plugin with sample data:
-
Run the verification script:
node tests/verify-plugin.js -
Install the packaged plugin in TablePlus.
-
Connect to a PostgreSQL database.
-
Run a query with the Visual Explain feature.
MIT
