SQLite Forum

Should SQLite be able to optimize this query?
Side note here: Not really an answer to your question, but wouldn't using `order by 2` even faster than `order by count(*)`?

select country_long, count(*)
from (
  select * from [global-power-plants] order by rowid
where country_long is not null
group by country_long
order by 2 desc