What SE question has the most views, and where could I find this information?
1 Answer
You can find it quite easily (per site) with a simple SEDE query:
SELECT TOP 10
id AS [Post Link],
ViewCount
FROM posts ORDER BY viewcount DESC
git - How do you undo the last commit? is the most viewed Stack Overflow question with over 3 million views.
Here is another query which returns the top 10 viewed queries from each Stack Exchange site, which proves the question above is indeed the most popular one over all Stack Exchange site. Further down the list it gives some mildly surprising results (at least in my opinion).
-- all databases
declare db_c cursor for select [name]
from sys.databases
where database_id > 5 -- skip master, temp, model, msdb, Data.SE
declare @db_c_name sysname -- holds name of db after fetch
declare @sql nvarchar(max) -- holds build up sql string
-- result table
create table #questions ( site nvarchar(250), id int, title nvarchar(250), viewcount int);
open db_c
fetch next from db_c into @db_c_name
while(@@FETCH_STATUS = 0)
begin
set @sql = N'use '+ QUOTENAME(@db_c_name) +';
insert into #questions
select top 10 '''+ QUOTENAME(@db_c_name) +''', id, title, viewcount
from posts
where posttypeid = 1
order by viewcount desc';
exec (@sql)
fetch next from db_c into @db_c_name
end;
close db_c;
deallocate db_c;
select * from #questions order by viewcount desc