Skip to main content
replaced http://data.stackexchange.com/ with https://data.stackexchange.com/
Source Link

The answer from Patrick is a reasonable indicator that doesn't hammer the SEDE database to much. It does report higher (sometimes way higher) counts for some posts then the actual /revisions page will show you. This is caused by the fact that some title, body and tag events will be rolled up in one revision, indicated by the same revisionguid, The following queryquery examines all available databases in SEDE and counts the actual revisions per post, including tag wikis:

For a per database query you can use this versionthis version

The answer from Patrick is a reasonable indicator that doesn't hammer the SEDE database to much. It does report higher (sometimes way higher) counts for some posts then the actual /revisions page will show you. This is caused by the fact that some title, body and tag events will be rolled up in one revision, indicated by the same revisionguid, The following query examines all available databases in SEDE and counts the actual revisions per post, including tag wikis:

For a per database query you can use this version

The answer from Patrick is a reasonable indicator that doesn't hammer the SEDE database to much. It does report higher (sometimes way higher) counts for some posts then the actual /revisions page will show you. This is caused by the fact that some title, body and tag events will be rolled up in one revision, indicated by the same revisionguid, The following query examines all available databases in SEDE and counts the actual revisions per post, including tag wikis:

For a per database query you can use this version

replaced http://meta.stackexchange.com/ with https://meta.stackexchange.com/
Source Link

The answer from Patrickanswer from Patrick is a reasonable indicator that doesn't hammer the SEDE database to much. It does report higher (sometimes way higher) counts for some posts then the actual /revisions page will show you. This is caused by the fact that some title, body and tag events will be rolled up in one revision, indicated by the same revisionguid, The following query examines all available databases in SEDE and counts the actual revisions per post, including tag wikis:

The answer from Patrick is a reasonable indicator that doesn't hammer the SEDE database to much. It does report higher (sometimes way higher) counts for some posts then the actual /revisions page will show you. This is caused by the fact that some title, body and tag events will be rolled up in one revision, indicated by the same revisionguid, The following query examines all available databases in SEDE and counts the actual revisions per post, including tag wikis:

The answer from Patrick is a reasonable indicator that doesn't hammer the SEDE database to much. It does report higher (sometimes way higher) counts for some posts then the actual /revisions page will show you. This is caused by the fact that some title, body and tag events will be rolled up in one revision, indicated by the same revisionguid, The following query examines all available databases in SEDE and counts the actual revisions per post, including tag wikis:

deleted 299 characters in body
Source Link
rene Mod
  • 92.1k
  • 17
  • 245
  • 516
-- result table, don't rename and keep the site column
create table #results ( site nvarchar(250)
                       , post int
                       , title nvarchar(250)
                     /*  , edittitle
                       , editbody int
                       , edittags int
                       , rbtitle int
                       , rbbody int
                       , rbtags int
                       , suggested int */
                       , revcnt int);

declare @sql nvarchar(max) = ''   -- holds build up sql string

-- build one biq union sql, for each db
select @sql = @sql 
+ iif( len(@sql) > 1 
     , 'union'
     , 'insert into #results'
) +
-- here goes the per site query, fully qualify the database objects
N'
select ''' + name + '''
     , postid
     , (select (case when q.title is null and q.parentid is not null then 
                  ( select title 
                   from ' + quotename(name) + '.dbo.posts mq 
                   where mq.id = q.parentid)
               else title
               end) as qtitle
        from ' + quotename(name) + '.dbo.posts q
        where id = postid ) as nqtitle
     , count(*) as cnt
from (select postid
           , revisionguid
      from ' + quotename(name) + '.dbo.posthistory ph 
      where ph.posthistorytypeid < 10 -- all edits
      group by postid
             , revisionguid
      ) as data
group by postid
having count(*) > 10
'
from sys.databases
where database_id > 5
-- and (name not like '%.Meta' or name = 'StackExchange.Meta')

--print @sql

-- execute it
exec (@sql)

-- show results
select top 10000
       site
       , 
       -- URL builder from Lamak http://stackoverflow.com/a/38129701
      'http://' 
      + case PARSENAME(site,1)
        when 'audio' then 'avp'
        else PARSENAME(site,1)
        end 
      + coalesce('.' 
        + case PARSENAME(site,2)
          when 'audio' then 'avp'
          else PARSENAME(site,2)
          end , '')
      + IIF(patindex('%.MathOverflow%',site) > 0
      , ''
      , coalesce('.' + PARSENAME(site,3), '')
      )
      + IIF(patindex('%.MathOverflow%',site) > 0
      , '.net'
      , '.com'
      ) 
      + '/posts/'
      + cast(post as nvarchar) 
      + '/revisions'
      + '|'
      + case when title is null 
             then 'tag wiki:' + cast(post as nvarchar) 
             else title
        end as [Post]
      -- rest of columns
      , revcnt as [Number of revisions]
from #results
order by revcnt desc

drop table #results
-- result table, don't rename and keep the site column
create table #results ( site nvarchar(250)
                       , post int
                       , title nvarchar(250)
                     /*  , edittitle
                       , editbody int
                       , edittags int
                       , rbtitle int
                       , rbbody int
                       , rbtags int
                       , suggested int */
                       , revcnt int);

declare @sql nvarchar(max) = ''   -- holds build up sql string

-- build one biq union sql, for each db
select @sql = @sql 
+ iif( len(@sql) > 1 
     , 'union'
     , 'insert into #results'
) +
-- here goes the per site query, fully qualify the database objects
N'
select ''' + name + '''
     , postid
     , (select (case when q.title is null and q.parentid is not null then 
                  ( select title 
                   from ' + quotename(name) + '.dbo.posts mq 
                   where mq.id = q.parentid)
               else title
               end) as qtitle
        from ' + quotename(name) + '.dbo.posts q
        where id = postid ) as nqtitle
     , count(*) as cnt
from (select postid
           , revisionguid
      from ' + quotename(name) + '.dbo.posthistory ph 
      where ph.posthistorytypeid < 10 -- all edits
      group by postid
             , revisionguid
      ) as data
group by postid
having count(*) > 10
'
from sys.databases
where database_id > 5
-- and (name not like '%.Meta' or name = 'StackExchange.Meta')

--print @sql

-- execute it
exec (@sql)

-- show results
select top 10000
       site
       , 
       -- URL builder from Lamak http://stackoverflow.com/a/38129701
      'http://' 
      + case PARSENAME(site,1)
        when 'audio' then 'avp'
        else PARSENAME(site,1)
        end 
      + coalesce('.' 
        + case PARSENAME(site,2)
          when 'audio' then 'avp'
          else PARSENAME(site,2)
          end , '')
      + IIF(patindex('%.MathOverflow%',site) > 0
      , ''
      , coalesce('.' + PARSENAME(site,3), '')
      )
      + IIF(patindex('%.MathOverflow%',site) > 0
      , '.net'
      , '.com'
      ) 
      + '/posts/'
      + cast(post as nvarchar) 
      + '/revisions'
      + '|'
      + case when title is null 
             then 'tag wiki:' + cast(post as nvarchar) 
             else title
        end as [Post]
      -- rest of columns
      , revcnt as [Number of revisions]
from #results
order by revcnt desc

drop table #results
-- result table, don't rename and keep the site column
create table #results ( site nvarchar(250)
                       , post int
                       , title nvarchar(250)
                       , revcnt int);

declare @sql nvarchar(max) = ''   -- holds build up sql string

-- build one biq union sql, for each db
select @sql = @sql 
+ iif( len(@sql) > 1 
     , 'union'
     , 'insert into #results'
) +
-- here goes the per site query, fully qualify the database objects
N'
select ''' + name + '''
     , postid
     , (select (case when q.title is null and q.parentid is not null then 
                  ( select title 
                   from ' + quotename(name) + '.dbo.posts mq 
                   where mq.id = q.parentid)
               else title
               end) as qtitle
        from ' + quotename(name) + '.dbo.posts q
        where id = postid ) as nqtitle
     , count(*) as cnt
from (select postid
           , revisionguid
      from ' + quotename(name) + '.dbo.posthistory ph 
      where ph.posthistorytypeid < 10 -- all edits
      group by postid
             , revisionguid
      ) as data
group by postid
having count(*) > 10
'
from sys.databases
where database_id > 5
-- and (name not like '%.Meta' or name = 'StackExchange.Meta')

--print @sql

-- execute it
exec (@sql)

-- show results
select top 10000
       site
       , 
       -- URL builder from Lamak http://stackoverflow.com/a/38129701
      'http://' 
      + case PARSENAME(site,1)
        when 'audio' then 'avp'
        else PARSENAME(site,1)
        end 
      + coalesce('.' 
        + case PARSENAME(site,2)
          when 'audio' then 'avp'
          else PARSENAME(site,2)
          end , '')
      + IIF(patindex('%.MathOverflow%',site) > 0
      , ''
      , coalesce('.' + PARSENAME(site,3), '')
      )
      + IIF(patindex('%.MathOverflow%',site) > 0
      , '.net'
      , '.com'
      ) 
      + '/posts/'
      + cast(post as nvarchar) 
      + '/revisions'
      + '|'
      + case when title is null 
             then 'tag wiki:' + cast(post as nvarchar) 
             else title
        end as [Post]
      -- rest of columns
      , revcnt as [Number of revisions]
from #results
order by revcnt desc

drop table #results
added 19 characters in body
Source Link
rene Mod
  • 92.1k
  • 17
  • 245
  • 516
Loading
Source Link
rene Mod
  • 92.1k
  • 17
  • 245
  • 516
Loading