Sites by relative meta activity (compared to the main)

1

Please login or register to vote for this query.

(click on this box to dismiss)

Compares the SE sites to their metas - shows the percentage of the users having a post on the meta site, compared to the percentage of the users having a post on the main. Counts only the users over the RepLimit. You can set this RepLimit to 1.

Poker Meta

Q&A about the site for serious players and enthusiasts of poker

--SELECT COUNT(DISTINCT OwnerUserId) FROM StackOverflow.dbo.Posts;
--SELECT COUNT(DISTINCT OwnerUserId) FROM [StackOverflow.Meta].dbo.Posts;

DECLARE dbcursor CURSOR FOR
WITH Raw AS (
  SELECT name
  FROM sysdatabases
  WHERE name NOT IN ('master', 'tempdb', 'model' ,'msdb', 'Data.StackExchange')
)
SELECT Main.name AS MainDb, Meta.name AS MetaDb
FROM Raw Main, Raw Meta
WHERE
  Main.name + '.Meta' = Meta.name;

DECLARE @MainDb VARCHAR(MAX);
DECLARE @MetaDb VARCHAR(MAX);
DECLARE @Query VARCHAR(MAX);

OPEN dbcursor;
FETCH NEXT FROM dbcursor INTO @MainDb, @MetaDb;

WHILE @@FETCH_STATUS = 0
BEGIN
  PRINT @MainDb + @MetaDb;
  SELECT @Query = '
    SELECT (SELECT COUNT(DISTINCT OwnerUserId)
      FROM [' + @MainDb + '].dbo.Posts) AS MainUserCount,
      (SELECT COUNT(DISTINCT OwnerUserId)
      FROM [' + @MetaDb + '].dbo.Posts) AS MetaUserCount
  ';
  FETCH NEXT FROM dbcursor INTO @MainDb, @MetaDb;
END;

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results