> If it is, his original query relies on a special quirk of SQLite that is not guaranteed to work the same in future, and will not work in any other SQL engine. It is indeed what I meant to get. I vaguely recall reading something about the non-standard behavior of sqlite's min/max function in the official documentation, but I can't find it now. Is my memory bad or is this documented somewhere? The "standard"-compliant query that you suggest is taking 3x as long as the original "non-standard" query (the non-standard query itself being 5x slower than my manual aggregation), so if that behavior isn't likely to change I might continue to use the "non-standard" behavior in the future.