Skip to content

Getting started

SQL Tamer rewrites bulky SQL before it reaches your database.

There are two normal paths:

  • Postgres app: call the Rewrite API, then run the returned plan on your own Postgres connection.
  • ClickHouse over HTTP: create one proxy destination, then point your client at the returned proxy_base_url.

You do not need the website for either path.

1. Install the CLI

Use the installer from the same website you are reading:

  • Hosted website: https://sqltamer.com/install.sh
  • Local website eval: http://127.0.0.1:8000/install.sh
curl -fsSL https://sqltamer.com/install.sh | sh

The hosted installer supports macOS (Apple Silicon and Intel) and Linux x86_64.

For a folder-local install that also keeps CLI auth/config next to the binary:

curl -fsSL https://sqltamer.com/install.sh | SQLTAMER_INSTALL_DIR="$PWD/.sqltamer/bin" sh

2. Create CLI auth

Replace SQLTAMER_BASE_URL with your API base URL.

  • Hosted product: use https://sqltamer.com
  • Local website eval: use http://127.0.0.1:8080
sqltamer auth init --server-url "$SQLTAMER_BASE_URL"

That creates preview access and saves the API key locally for the CLI.

If you want to use curl, reveal the raw key with:

sqltamer auth show --reveal

3. Try it quickly

Postgres

Send one query to POST /v1/rewrite:

curl -X POST "$SQLTAMER_BASE_URL/v1/rewrite" \
  -H "Authorization: Bearer $SQLTAMER_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
    "sql": "SELECT id, email FROM users WHERE id IN (101, 202, 303, 404, 505)",
    "dialect": "postgres",
    "min_in_list_items": 3
  }'

What comes back:

  • Sometimes only main_sql and main_bindings
  • Sometimes setup_sql, load_ops, and cleanup_sql too
  • Your app runs that plan on one Postgres session

ClickHouse over HTTP

Create one destination:

sqltamer clickhouse add \
  --name production \
  --upstream https://clickhouse.example.com:8443/ \
  --min-in-list-items 3

Then point your ClickHouse HTTP client at the returned proxy_base_url and keep your normal ClickHouse username and password. If the returned URL stays on https://sqltamer.com/v1/proxy/clickhouse/..., also send your SQL Tamer API key as X-API-Key on the proxy request.

For quick validation, use a lower --min-in-list-items value like 3. Hosted ClickHouse destinations default to 1000.

4. Open the page you actually need