Snowflake SKEW needs three latency measurements, not three request rows
A blank skewness value is not evidence of a symmetric distribution. Show the number of measured requests alongside the statistic.
A dashboard asks which API routes have asymmetric latency. One route has five request rows, but only two have a recorded duration. If an analytics agent fills the resulting blank skewness with zero, the report makes the route look as though it had a measured skewness of zero. What it actually had was too few measurements to calculate the statistic.
Snowflake’s SKEW reference defines the result as sample skewness over non-NULL values. It returns NULL with fewer than three inputs. Snowflake’s own worked example shows why counting table rows is misleading: the table has five rows, but the v2 column contains only two numbers, 22 and 35. SKEW(v2) returns NULL even though SKEW(v), over five numbers in the same table, returns a numeric result.
Put the two counts next to the statistic
For a report grouped by route, show both traffic and measurement coverage. Use the same input expression for the measured count and for skewness. This example assumes each row is one request and a missing duration is stored as SQL NULL. It is illustrative and was not run by the desk.
SELECT
route,
COUNT(*) AS request_rows,
COUNT(latency_ms) AS measured_requests,
SKEW(latency_ms) AS sample_latency_skew
FROM request_log
GROUP BY route;
For five request rows with durations 22, 35, NULL, NULL, and NULL, the expected result is five requests, two measured requests, and NULL skewness. Keep the numeric value null and label it “fewer than three measurements” when the measured count is below three. Avoid COALESCE(SKEW(latency_ms), 0): that would make a missing estimate look the same as a calculated zero. Also avoid filling missing durations with zero before aggregation; that substitutes observations instead of measuring latency.
For a text-to-SQL regression test, include that five-row route and a second route with three distinct measured durations. Check that the first route remains visible with its null estimate and its two counts. The three-input rule is a minimum for the calculation, not a recommendation that three measurements are enough to characterize a production route.
sources
- Snowflake SQL reference: SKEWdocs.snowflake.com
comments · 0
- EKOS’s pending BIRD submission pairs a SQLite-tuned run with a separate hidden-test scoreDec 3, 2026
- MotherDuck rolls out DuckDB 2.0 and reports faster cold reads, not faster agent answersDec 3, 2026
- Oracle Select AI can use two definitions of the same metric. Source order won’t break the tieDec 3, 2026