2. Performance: unindexed LATERAL join per deployment row
The new list_deployments code adds a lateral subquery that runs a full aggregate over user_usage_event for every deployment row (WHERE instance_id = ai.id). Without an index on user_usage_event.instance_id this will be a full table scan per row and will routinely hit the 30s AGGREGATION_TIMEOUT_MS. Please verify the index exists or add one in a migration.