AWS Summit Jakarta 2026 · Demo Booth

Kiro for .NET: MS SQL Server Optimization
in Hours, Not Days

An AI-assisted workflow for diagnosing and fixing slow SQL Server queries on .NET Core — from raw query to root cause to a working fix

👨‍💻
Ifan Jaya Suswanto Zalukhu
AWS Community Builder
Co-organizer, AWS User Group Medan
Head of Engineering, SimpliDOTS

← → navigate  ·  L light mode  ·  F fullscreen

1 · Pain Point

Slow Query? That's Raw SQL.
Your Code? That's ORM.

If you've worked on a .NET Core app using an ORM (Object-Relational Mapping — an "auto-translator" between your code and the database), this is familiar:

  • The database suddenly spikes, and you get handed the raw SQL query that's causing it
  • But your codebase is written in ORM / LINQ syntax — a form that looks nothing like that raw query
  • Tracing the raw query back to the exact line of code that generated it means manually searching and guessing across the codebase
  • Whoever's searching gets exhausted — and whoever fixes it afterward gets exhausted too
The result: finding the one query that's spiking the database used to take days — before anyone even starts fixing it.
1 · Pain Point → Enter Kiro

From Raw Query to Root Cause, Fast

❌ Before
  • Manually grep the codebase, guessing which LINQ expression maps to that raw SQL
  • Cross-check table and column names by hand
  • Ask around the team, still not fully sure
Days, just to investigate
✓ With Kiro
  • Kiro has no live connection to the database — you run the raw query yourself and hand the result to Kiro, along with access to the codebase
  • Kiro traces which ORM/LINQ code actually generates that exact query
  • Because Kiro can see the codebase, it also suggests how to optimize the query
  • You learn something new about your own codebase along the way
Hours — root cause + a suggested fix
2 · Architecture

The Demo Stack

🖥️
Frontend
Angular 18 SPA — a dummy web supply chain / distribution management system (DMS)
⚙️
Backend
ASP.NET Core 5 Web API + EF Core — a dummy backend built close to a real-world case
🗄️
Database
SQL Server 2022 in Docker, using a dummy / sample database (WideWorldImporters)
Angular 18 → ASP.NET Core 5 API → EF Core → SQL Server 2022 (WideWorldImporters)
2 · Architecture

Kiro Also Writes It Down

Because Kiro has full access to the codebase, every optimization round becomes three things:

🔍
Finds It
Traces the raw query back to the exact ORM/LINQ code generating it
🛠️
Fixes It
Proposes concrete index or query changes to optimize it
📝
Documents It
Every round is written down as a markdown file — more on this next →
2 · Architecture

Living Documentation: Query Optimization History

Every analysis is committed as its own markdown file, capturing: problem · analysis result · recommendation / next action · before & after performance.

Day 1
Analyze & Record
Found a slow query that needs a new index — recorded in a new .md file
Day N
Re-check & Compare
Send the latest query insight + performance, ask Kiro to compare it against the previous .md
New .md
Updated History
Kiro writes a new file noting whether the earlier fix actually helped
Not just a changelog — a written why, so nothing gets re-broken by accident.
2 · Architecture

One History, Two Safety Nets

🧠 Smarter Analysis
Kiro reads prior rounds before suggesting anything new — so it won't casually recommend dropping an index that turns out to matter, because the history already explains why it's there.
🔎 Smarter Code Review
The same history folder feeds into steering/hooks during code review — flagging new code that isn't index-optimal or risks reintroducing a previously-solved problem.
The result: less guesswork today, and a safety net for every change tomorrow.
3 · How to Use

The Demo Flow, Step by Step

1
Run Locally
Start frontend, backend, and database locally per the README
2
Spot the Slow Query
Check for slow/long-running queries — in production this could come from a CPU/IO performance alert
3
Audit
Run the audit scripts and paste the results into the project folder
4
Ask Kiro
Kiro explains the problem, locates it in the current codebase, and suggests a fix
5
Review & Verify
Review the recommendation, apply the change, confirm the performance improved
3 · How to Use

6 DMV Scripts Power the Diagnosis

ScriptPurpose
01-wait-stats.sqlWait statistics from sys.dm_os_wait_stats
02-top-io-queries.sqlTop I/O queries from sys.dm_exec_query_stats
03-current-indexes.sqlExisting indexes from sys.indexes
04-index-usage-stats.sqlIndex usage from sys.dm_db_index_usage_stats
05-missing-indexes.sqlMissing index recommendations
06-index-fragmentation.sqlIndex fragmentation analysis
Output from these scripts is what gets pasted into the project folder in step 3 — the input Kiro reads in step 4.
3 · Benefit

What Used to Take Days,
Now Takes Hours

✓ Faster Root-Cause
From raw query straight to the exact code and a suggested fix — no more manual detective work across ORM layers
✓ Compounding Knowledge
Every round is documented, so today's fix informs tomorrow's analysis — and even feeds into code review
Thanks!

Try It Yourself

Full setup instructions and demo flow are in the README.

Let's Connect

Contact

1 / 12