Skip to main content

SQL_RAW

Constant SQL_RAW 

pub const SQL_RAW: &str = "
    -- `changes` has PRIMARY KEY (rev, path), so COUNT(rev) == COUNT(*) ==
    -- COUNT(DISTINCT rev) for any GROUP BY path. The plain COUNT skips
    -- DuckDB's distinct-tracking overhead on a column that is already
    -- unique within the group.
    SELECT path, COUNT(rev) AS n_revs
    FROM changes
    GROUP BY path
    HAVING n_revs >= ?
    ORDER BY n_revs DESC, path ASC
    LIMIT ?
";
Expand description

Per-file revision count, gated on --min-revs and capped by --rows. Bound values: min_revs, row_limit (i64::MAX = unlimited).