Share links

функциональный

How a plan travels inside the link itself: Brotli and base64url after the #, why it works that way, the size limits, and building a link from a script.

Copy share link в online query plan viewer puts everything you entered into the link itself: the plan, the table definitions, the query text and the second plan. Nothing is stored on sqlly.app. Whoever opens the link gets the same analysis, worked out again in their own browser tab.

How a link is built

  1. The four input boxes and the format choice are written out as a small JSON object.
  2. That JSON is compressed with Brotli at quality 11, its highest setting.
  3. The compressed bytes are encoded as base64url (letters, digits, - и _, no padding).
  4. The result goes after #b= at the end of the page address, and the viewer copies the whole link and shows it in the address bar.
https://sqlly.app/tools/query-plan-viewer#b=W83QQUTVqEM4D2xb1PoCEjiT8h…

Opening the link runs the same steps backwards. The letter before the = says how the rest was packed, so links made before Brotli still open:

ПрефиксPackingMade when
#b=Brotli, quality 11Today, whenever the Brotli module loads
#z=Deflate (raw), the browser's own CompressionStreamOlder links, and today if the Brotli module can't load
#j=Not compressedOlder links, and browsers with neither

Why it works this way

The plan stays out of our servers
Browsers never send the part of an address after # to the server, not even in the request for the page. So there's no upload, no database of other people's SQL, no retention policy and no account. A plan holds your SQL, table names and sometimes parameter values, and we'd rather never have them. A short link would mean keeping a copy.
Brotli rather than deflate
Plans repeat themselves: the same element and property names, operator names and numbers again and again. Brotli looks back much further than deflate's 32 KB window and comes with a built-in dictionary of common text, so it finds more of that repetition. Across the 209 plans in our test corpus, Brotli links came out 17% shorter overall than deflate links. The median plan was 13% shorter, and PostgreSQL JSON plans up to 47% shorter. Shorter links fit into more of the places people paste them.
The highest setting
Quality 11 is slow to compress and quick to open. The person making the link pays once, under 200 ms for every plan in our tests on a laptop, and about 1.4 s per MB of input. Everyone who opens it unpacks it in a few milliseconds.
Loaded only when needed
Browsers decompress Brotli for downloads but don't let a page use it, so the viewer ships its own copy, the open-source brotli-wasm module, about 1 MB. It's fetched only when you make or open a link, and it starts loading as your pointer reaches the button.
base64url
Compressed bytes aren't text. base64url turns them into characters that need no escaping in an address and that chat apps and mail clients recognise as part of the link. It costs a third more length, which is still far smaller than the plan itself.
A size check while opening
A few hundred bytes of crafted Brotli can unpack to gigabytes. The viewer unpacks in 64 KB steps and gives up at 8 MB, so a link built to swamp your tab just doesn't open. A 165-byte link that would expand to 100 MB is refused.

Ограничения

ЛимитWhat happens
8 MB of input before compression (all four boxes together)No link is made and nothing is copied; the viewer says how big the input was. The same cap applies when a link is opened.
2 MB link (Chrome and Edge)Chrome and Edge won't open a longer address, so the viewer refuses to make one.
Firefox: 1 MB. Safari: no fixed limit.The viewer marks which browsers the link fits.
Slack 40,000 characters, Microsoft Teams about 28 KB, Discord 2,000 (4,000 with Nitro), email safest under 2,000After you copy a link, the panel under the button shows a check, a warning or a cross for each.

In practice the limits are loose. Of the 209 real plans in our tests, the longest link was 4,520 characters, from a 30 KB SQL Server actual plan with several statements. 189 of them fit in a single Discord message.

A link is the plan, not a pointer to it. It's compressed, not encrypted. Anyone who has the link can read everything in it, and it is stored wherever you paste it: the chat message, the ticket, the email, your browser history and anything that syncs it. There's no expiry and no way to revoke it. Share it the way you would share the plan file.
  • A link is a snapshot. Edits after you copy it aren't in it; press Copy share link снова.
  • Opening one needs sqlly.app. The page, the plan engine and the Brotli module load from the site; only the plan comes from the link.
  • The page works out the analysis again. If the viewer improves, an old link can show newer findings for the same plan.

Ways to use it

  • Ask for help with a slow query. Paste the link in Slack, Teams, a GitHub issue (65,536 characters per comment) or a forum post, instead of attaching a .sqlplan file that people have to download and open in something.
  • Keep before and after together. Put the plan after your index or rewrite in Plan after a change and the link carries both, with the comparison. Useful in a pull request or a postmortem.
  • Include the table definitions. The link carries them too, so whoever opens it gets the schema-aware advice without asking you for the DDL.
  • Bookmark a plan. The address bar holds the link after you copy it, so a bookmark brings the plan back, on any machine.
  • Build links from a script. The format is plain: the snapshot below, Brotli, base64url. A test job or a monitoring script can capture a plan and post a link with no service in between.

Building a link yourself

The JSON the viewer packs has these fields. Only p is required.

ПолеHolds
v1, the snapshot version.
pThe plan text, exactly as you would paste it.
sTable definitions (optional).
qQuery text (optional).
aThe plan after a change (optional).
fA plan format id from the viewer's Формат плана list, or auto (the default).

From a shell, with jq и brotli command-line tool:

jq -nc --rawfile p plan.sqlplan '{v: 1, p: $p}' \
  | brotli -q 11 -c \
  | base64 | tr '+/' '-_' | tr -d '=\n' \
  | sed 's|^|https://sqlly.app/tools/query-plan-viewer#b=|'

From Node.js, with nothing to install:

import { readFileSync } from 'node:fs';
import { brotliCompressSync, constants } from 'node:zlib';

const snapshot = { v: 1, p: readFileSync('plan.json', 'utf8') };
const packed = brotliCompressSync(JSON.stringify(snapshot), {
  params: { [constants.BROTLI_PARAM_QUALITY]: 11 },
});
console.log('https://sqlly.app/tools/query-plan-viewer#b=' + packed.toString('base64url'));

Any standard Brotli encoder works; the viewer doesn't care which one made the bytes. Leave off the = padding: a link with it doesn't open.