AI & ML2025-03-076 min read

Ask Your Cloud Costs a Question: The Power of Text-to-SQL for FinOps

What if you could just ask 'What's my most expensive service this month?' and get an instant answer? Text-to-SQL AI makes this possible.

OT

OCIFinOps Team

Traditional cost analysis tools require you to know exactly which dashboard to open, which filters to apply, and how to interpret the results. But what if you could just ask a question?

The Problem with Traditional Cost Analysis

Consider this scenario: your VP of Engineering asks, "How much did we spend on database services in the APAC region last quarter?" In a traditional workflow, you'd need to:

1. Open the cost reporting tool

2. Select the right date range

3. Filter by service category

4. Filter by region

5. Export the data

6. Possibly pivot in a spreadsheet

This takes minutes to hours, depending on the tool. With natural language queries, it takes seconds.

How Text-to-SQL Works

OCIFinOps uses AI to convert plain English questions into SQL queries that run against your cost data. The process works in three steps:

1. Understanding the Question

The AI model parses your question to identify:

What: you're asking about (cost, usage, count)

Which dimensions: to filter on (service, region, compartment, time)

How: to aggregate (sum, average, group by)

2. Generating the Query

Using knowledge of your database schema and OCI cost report structure, the AI generates a precise SQL query. For example:

"What's my most expensive service this month?" becomes:

SELECT product_service, SUM(cost_my_cost) as total_cost

FROM cost_data

WHERE interval_usage_start >= DATE_TRUNC('month', CURRENT_DATE)

GROUP BY product_service

ORDER BY total_cost DESC

LIMIT 1

3. Returning Results

The query runs against DuckDB (our embedded analytical database) and results are returned instantly — along with the generated SQL for full transparency.

Example Questions You Can Ask

Here are real questions our users ask daily:

"What's my total spend this month compared to last month?"

"Which compartment has the highest compute costs?"

"Show me the daily trend for Object Storage costs in the last 30 days"

"What are my top 5 most expensive resources?"

"How much am I spending on networking across all regions?"

"What percentage of my spend goes to databases?"

Why This Matters

Natural language queries democratize cost data. Instead of requiring specialized knowledge of cost reporting tools, anyone in the organization can get answers. This means:

Finance teams: can pull numbers for budgeting without engineering help

Engineering managers: can check their team's spend without navigating complex dashboards

Executives: can get high-level summaries instantly

The goal is to make cloud cost data as accessible as asking a colleague a question.

Ready to optimize your OCI costs?

Start with a free demo and see how OCIFinOps can help.