gulliver_rehearse
Runs a SQL query on small samples to measure runtime, rows, and bytes, then predicts full-run cost with a confidence range. Use it when joins or skew make estimates unreliable.
Instructions
Run the query on small samples (default 1%, 3%, 10% of the largest table), measure runtime/rows/bytes and predict the full run with a confidence range. Costs a fraction of the full run (budget-checked first). Never writes data. Use it when gulliver_preflight says needs_rehearsal, or when joins or skew make the estimate unreliable; the growth exponent flags joins that multiply rows. Logs a receipt for gulliver_receipt.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes | Exactly one SQL statement (SELECT/WITH) in the connection's dialect. Several statements are rejected. | |
| method | No | auto: block sampling (system, cheap) for big tables, row sampling (bernoulli, more even) for small ones. system: always blocks. bernoulli: always rows. | auto |
| sample | No | Sample only the largest table (default, keeps joins honest; in a self-join only its first occurrence) or every table and occurrence with its own seed (cheaper, rougher for joins). | largest |
| fractions | No | Sample sizes as fractions between 0 and 1, smallest first. Default [0.01, 0.03, 0.1]. At least two are needed to fit a prediction. | |
| connection | No | Connection name as listed by gulliver_status (from gulliver.toml or GULLIVER_DSN). Omit for the default connection. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | Yes | ||
| next_step | Yes |