-- @query feedback_appdata_general
-- @db thumbnailCache 9.0
-- @with account_scope
-- @db media 11.0
-- @db listSync 1.0
-- @param account_id TEXT
-- @end-with
SELECT
    -- @with account_scope
    (SELECT COUNT(*) FROM media.media_properties) AS mediaItems,
    (SELECT COUNT(*) FROM listSync.a2od_mountpoints) AS a2odFolderCount,
    (SELECT COUNT(*) FROM listSync.throttle_history
        WHERE startTime > strftime('%s', 'now', '-1 hour')) AS throttleLastHourCount,
    (SELECT apiName FROM listSync.throttle_history
        WHERE startTime > strftime('%s', 'now', '-1 hour')
        GROUP BY apiName ORDER BY COUNT(*) DESC LIMIT 1) AS throttleTopApi,
    -- @end-with
    (SELECT COUNT(*) FROM thumbnailCache.thumbnail_metadata) AS thumbnailsCached,
    (SELECT COUNT(*) FROM thumbnailCache.thumbnail_retries) AS thumbnailsPending
