SQLite User Forum

MIN()/MAX() performance thought
Login
3.36.0, amalgamation.

Given a table t with a column c with an index ON t (c), I find that

SELECT MIN(c), MAX(c) FROM t;

is substantially slower than

SELECT MIN(c) FROM t;
SELECT MAX(c) FROM t;

(though the difference is obvious to a human only when t is at least moderately large).

Looking at EXPLAIN QUERY PLAN output, this is understandable (scanning the table versus just looking up the extrema in the index).  I'm wondering if the former form is worth special-casing; I certainly find myself doing it often enough in the shell.