QueryDeck Docs
Querying

Snippets

Built-in diagnostic queries and your own reusable SQL blocks, one drag away.

For: analysts and developers.

Snippets are short, reusable bits of SQL. QueryDeck ships with a curated library of diagnostic queries for PostgreSQL and MySQL, and you can add your own.

Open the snippets panel

Way to openWhere
SidebarSnippets section
Command paletteCmd+K, type "snippets"
MenuViewShow Snippets

The panel splits into two folders by default:

  • Built-in — diagnostics that ship with QueryDeck
  • My snippets — your own additions

Built-in snippets

These are the queries we use ourselves. They are read-only — you can drag them into the editor, copy them, or fork them into "My snippets" to customize.

PostgreSQL

SnippetWhat it shows
Table sizesEvery table sorted by total size on disk (data + indexes + toast)
Index usageWhich indexes are actually used and which are dead weight
Slow queriesTop queries by total time from pg_stat_statements
LocksCurrent blocking locks with the holder and waiter
Active connectionsSessions on the server with their state, query, and idle time
Bloat estimateTables with significant dead row counts
Cache hit ratioBuffer cache hit rate per table

MySQL

SnippetWhat it shows
Table sizesEvery table sorted by size in MB
Slow queriesQueries from the slow log if enabled
Active connectionsSessions on the server with their state and query
InnoDB statusOutput of SHOW ENGINE INNODB STATUS
Buffer pool statsHit ratio and dirty page count

If you connect to a database where a snippet doesn't apply (e.g., pg_stat_statements not enabled), the snippet still runs and the server returns a helpful error pointing you at the missing extension or grant.

Insert a snippet into the editor

Three ways:

  • Double-click a snippet — opens a new tab with the SQL ready to run.
  • Drag a snippet onto an existing tab — inserts at the cursor.
  • Cmd+K → type the snippet name → press Enter.

The snippet stays in the library after insertion. Edit your tab freely.

Create your own snippet

  1. Highlight the SQL in the editor you want to save.
  2. Right-click → Save as Snippet...
  3. Give it a name. Optionally add a description and a folder.
  4. Save.

You can also create a snippet from scratch: in the snippets panel, click + and start typing.

Organize with folders

Right-click in the panel to create a folder. Drag snippets into it. Folders can be nested.

A useful structure for a team:

Snippets/
├── Built-in/
│   └── ...
└── My snippets/
    ├── Auth & users/
    │   ├── Find user by email
    │   └── Reset password (no-op example)
    ├── Stripe/
    │   ├── Last 50 charges
    │   └── Refunds today
    └── Performance/
        └── Tables without indexes

Parameterized snippets

A snippet can include placeholders. Use {{name}} syntax:

SELECT * FROM users WHERE email = '{{email}}';

When you insert a parameterized snippet, QueryDeck opens a small form asking for each placeholder. Fill, press Enter, and the SQL is inserted with the values filled in.

Placeholders are simple text substitution. They are not SQL bind parameters — if you're handling untrusted input, write the query manually.

Snippets vs saved queries

SnippetsSaved queries
Short, reusable blocks of SQLFull queries you want to keep
Inserted into a tab to composeLoaded as a tab to run as-is
Not tied to a connectionTied to one or more connections
Built-in library ships with the appAlways your own

If you find yourself running the same long query every Monday, that's a saved query. If you're constantly typing the same JOIN pattern, that's a snippet.

What's next