Which one is faster? And what are the differences?
According to this stackoverflow thread,
these two expressions are identical and DISTINCT is actually implemented by GROUP BY. If one of them is faster, it’s going to be
DISTINCT. However, this thread is discussing MySQL.
For SQLite, you can use EXPLAIN QUERY PLAN to show how each query is executed:
sort on a column having no index
sort on a column having index
From their query plans above, they are exactly the same! Actually, you can find out the answer from this link,
where it explains that both GROUP BY and DISTINCT use a temporary B-Tree to sort the output rows when there are no indexes created!