Analyze service costs by subaccount
By understanding the services incurring the highest cost in a subaccount for a period of time, Engineers can get a high-level picture of where to prioritize their efforts when it comes to optimizing usage. Often, the largest optimization opportunities are in the services that incur the most cost.
- Source
- FOCUS MCP snapshot
- FOCUS editions
- v1.0, v1.1, v1.2, v1.3, v1.4
- Queries
- 1
- Mode
- Read-only
- Library snapshot (UTC)
- 2026-10-08
Analyze service costs by subaccount
Runs on sample- Source
- FOCUS 1.0 sample
- Result rows
- 10
- Status
- Runs on sample
- Execution
- Precomputed
- Result snapshot (UTC)
- 2026-10-11
Top service costs for subaccount
10 rows. Scroll inside the table to see more.
Inspect Postgres SQL and original FOCUS SQL
Postgres SQL, as run
select charge_period_start,
sub_account_id,
sub_account_name,
service_name,
sum(effective_cost) as total_effective_cost
from focus.cost_and_usage
where sub_account_id = $1::text
and charge_period_start >= $2::timestamptz
and charge_period_end < $3::timestamptz
group by 1, 2, 3, 4
order by total_effective_cost desc nulls last, charge_period_start, service_name
limit 10Original FOCUS SQL
SELECT ChargePeriodStart, SubAccountId, SubAccountName, ServiceName, SUM(EffectiveCost) AS TotalEffectiveCost FROM focus_data_table WHERE SubAccountID = ? AND ChargePeriodStart >= ? AND ChargePeriodEnd < ? GROUP BY ChargePeriodStart, SubAccountId, SubAccountName, ServiceName ORDER BY SUM(EffectiveCost) DESC LIMIT 10
Columns used
Column names from the source use case.