\pset pager off
\pset tuples_only on
\pset fieldsep '\t'
SELECT 'null_top', count(*), coalesce(error_phase,''), coalesce(error_owner,''), coalesce(status_code,0), coalesce(request_path,''), coalesce(model,''), left(error_message,140)
FROM ops_error_logs
WHERE created_at >= TIMESTAMPTZ '2026-05-11 20:30:00+08' AND created_at < TIMESTAMPTZ '2026-05-11 21:20:00+08'
  AND account_id IS NULL
GROUP BY 3,4,5,6,7,8 ORDER BY 2 DESC LIMIT 25;
SELECT 'grp97_key', count(*), user_id, api_key_id, model, request_path, error_message
FROM ops_error_logs
WHERE created_at >= TIMESTAMPTZ '2026-05-11 20:30:00+08' AND created_at < TIMESTAMPTZ '2026-05-11 21:20:00+08'
  AND group_id=97
GROUP BY 3,4,5,6,7 ORDER BY 2 DESC LIMIT 25;
