<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/i-let-ai-recommend-sql-server-indexes-across-a-week-of-queries-mtqeb2wzd" -->

---
title: I Let AI Recommend SQL Server Indexes Across a Week of...
description: A week-long experiment fed individual SQL Server queries to a general-purpose AI chat model, one at a time, asking for index recommendations without giving it...
canonical: https://daily.dev/posts/i-let-ai-recommend-sql-server-indexes-across-a-week-of-queries-mtqeb2wzd
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: I Let AI Recommend SQL Server Indexes Across a Week of Queries | daily.dev
og:description: A week-long experiment fed individual SQL Server queries to a general-purpose AI chat model, one at a time, asking for index recommendations without giving it...
og:url: https://daily.dev/posts/i-let-ai-recommend-sql-server-indexes-across-a-week-of-queries-mtqeb2wzd
og:image: https://api.daily.dev/og/posts/mTQeb2WZD.png
og:image:alt: I Let AI Recommend SQL Server Indexes Across a Week of Queries
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# I Let AI Recommend SQL Server Indexes Across a Week of Queries

**[SQL Authority](https://daily.dev/sources/sql-authority)** · 13 min read · 8 upvotes · 5 comments

## Summary

A week-long experiment fed individual SQL Server queries to a general-purpose AI chat model, one at a time, asking for index recommendations without giving it execution plans, existing indexes, or workload context. The isolated recommendations were largely sensible: reads across six queries dropped from 23,870 to 3,446 and duration from 290.1ms to 84.7ms after applying seven suggested indexes. But hidden costs emerged: a combined insert batch took 2.9x longer (592ms to 1,703ms) and index storage grew from 66MB to 170MB, none of which the AI ever priced since it only saw the query text. A Friday query produced an overlapping-but-not-redundant index candidate that the author initially misjudged as redundant, illustrating that a stateless chat model can answer a narrow question well while remaining blind to portfolio-wide tradeoffs like write cost, storage, and index overlap.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.sqlauthority.com/2026/08/28/i-let-ai-recommend-sql-server-indexes-across-a-week-of-queries>

## Questions this post answers

### Can I trust an AI chatbot's SQL Server index recommendations without giving it the execution plan or existing indexes?

AI recommendations based only on query text and table definitions can be locally sensible but incomplete. In one tested week, six AI-suggested indexes cut logical reads by 86% and duration by 71%, but a combined insert batch of 20,000 orders and 60,000 order items took 2.9 times longer afterward, and index storage grew from 66MB to 170MB, none of which the model priced because it never saw the workload.

_Anyone weighing AI index suggestions against real write costs can compare notes and benchmarks on daily.dev._

### Why would an AI-recommended index that looks redundant actually not be redundant?

An index can look redundant because it shares a leftmost key column with an existing index, yet still be necessary if it returns a column the existing index does not include. In one case, a new index on CustomerID appeared redundant against an existing CustomerID, OrderDate index, but the new one also covered the Status column that the older index lacked, making it a legitimate covering index rather than pure duplication.

_Developers auditing overlapping indexes can dig into cases like this via daily.dev before dropping anything._

### Why did adding indexes based on AI recommendations slow down insert performance in SQL Server?

Each nonclustered index adds write overhead because SQL Server must update every index entry on every insert. In a tested batch of 20,000 new orders and 60,000 order items, insert time rose from 592ms with no nonclustered indexes to 1,703ms after seven AI-recommended indexes were added, a 2.9x slowdown that no query-only recommendation had accounted for.

_Teams balancing read speed against write cost can track index tradeoffs like this through daily.dev._

## Community discussion

Top comments from developers on daily.dev.

**@taiwofrancis** · 1 upvotes

> This is exactly where AI is useful but also a little dangerous. It can optimize the query in front of it, but it doesn’t see the bigger picture.

**@pdfopsdev** · 1 upvotes

> did you ever try re-running it with the existing index list included as context? feels like most of the write-amplification tax you hit is exactly what you'd expect from optimizing each query in isolation, since index selection is a portfolio problem not a bunch of independent ones.

**@agustinbarrientos** · 0 upvotes

> Before execution, I'd give the model a fixed write and storage budget. Every proposed index should name the existing one it replaces or justify expanding the portfolio.

**@leonidbugaev** · 0 upvotes

> The read numbers are real, but the part I'd sit with is what the model was never shown. It saw query text, so it optimized the one thing in front of it. Write cost, storage, index overlap across the workload were never on the table, so they were never priced. That's not the model being wrong. It answered the question you handed it. The obligation "don't regress the inserts" lived only in your head, so nothing could check it. Until write throughput and a storage budget are a check that can fail, a per-query recommendation keeps passing while the batch quietly gets slower.

## Similar posts on daily.dev

- [Validating AI-Generated Index Recommendations](https://daily.dev/posts/validating-ai-generated-index-recommendations-levl1hpum) · SQL Authority · 0 upvotes · 0 comments
- [The unbearable lightness of one more index](https://daily.dev/posts/the-unbearable-lightness-of-one-more-index-kpu7ly7ec) · Planet PostgreSQL · 4 upvotes · 0 comments
- [Nine Unusual Ways My Clients Use AI With SQL Server](https://daily.dev/posts/nine-unusual-ways-my-clients-use-ai-with-sql-server-399rw1ejp) · SQL Authority · 0 upvotes · 0 comments

---

Tags: [#performance](https://daily.dev/tags/performance), [#database](https://daily.dev/tags/database), [#ai-coding](https://daily.dev/tags/ai-coding), [#microsoft-sql-server](https://daily.dev/tags/microsoft-sql-server)

[View this post on daily.dev](https://daily.dev/posts/i-let-ai-recommend-sql-server-indexes-across-a-week-of-queries-mtqeb2wzd)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"I Let AI Recommend SQL Server Indexes Across a Week of Queries","url":"https://daily.dev/posts/i-let-ai-recommend-sql-server-indexes-across-a-week-of-queries-mtqeb2wzd","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/i-let-ai-recommend-sql-server-indexes-across-a-week-of-queries-mtqeb2wzd"},"datePublished":"2026-08-28T01:32:43.868Z","dateModified":"2026-09-14T08:38:35.692Z","description":"A week-long experiment fed individual SQL Server queries to a general-purpose AI chat model, one at a time, asking for index recommendations without giving it...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/a9eb23fe87e5f16c9377a5622627dbbb?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/a9eb23fe87e5f16c9377a5622627dbbb?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"SQL Authority","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"SQL Authority","logo":"https://media.daily.dev/image/upload/s--reCGnvgi--/f_auto,q_auto/v1780213436/logos/sql-authority?_a=BAMAMiWQ0","url":"https://daily.dev/sources/sql-authority"},"commentCount":5,"discussionUrl":"https://daily.dev/posts/i-let-ai-recommend-sql-server-indexes-across-a-week-of-queries-mtqeb2wzd","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":8},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":5}],"keywords":"performance,database,ai-coding,microsoft-sql-server","timeRequired":"PT13M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"SQL Authority","item":"https://daily.dev/sources/sql-authority"},{"@type":"ListItem","position":3,"name":"I Let AI Recommend SQL Server Indexes Across a Week of Queries"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/i-let-ai-recommend-sql-server-indexes-across-a-week-of-queries-mtqeb2wzd","comment":[{"@type":"Comment","text":"This is exactly where AI is useful but also a little dangerous. It can optimize the query in front of it, but it doesn’t see the bigger picture.","datePublished":"2026-08-28T12:09:40.138Z","url":"https://daily.dev/posts/mTQeb2WZD#c-inn8EbNji","author":{"@type":"Person","name":"Francis","url":"https://daily.dev/taiwofrancis","image":"https://media.daily.dev/image/upload/s--Eux7Ia33--/f_auto,pg_1/v1792512435/avatars/avatar_FStpm3ZejUD3qGlEeoOUS?_a=BAMAMicg0"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}},{"@type":"Comment","text":"did you ever try re-running it with the existing index list included as context? feels like most of the write-amplification tax you hit is exactly what you’d expect from optimizing each query in isolation, since index selection is a portfolio problem not a bunch of independent ones.","datePublished":"2026-08-29T18:11:03.505Z","url":"https://daily.dev/posts/mTQeb2WZD#c-5acODpajd","author":{"@type":"Person","name":"PDFops","url":"https://daily.dev/pdfopsdev","image":"https://media.daily.dev/image/upload/s---8isRBKc--/f_auto/v1782922291/avatars/avatar_orjMeK8QKaaVZwGq7ScPz?_a=BAMAMicg0"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}},{"@type":"Comment","text":"Before execution, I’d give the model a fixed write and storage budget. Every proposed index should name the existing one it replaces or justify expanding the portfolio.","datePublished":"2026-08-30T12:22:49.343Z","url":"https://daily.dev/posts/mTQeb2WZD#c-skJjx9tuf","author":{"@type":"Person","name":"Agustin Barrientos","url":"https://daily.dev/agustinbarrientos","image":"https://media.daily.dev/image/upload/s--5ayxQnqn--/f_auto/v1788281802/avatars/avatar_wQYYVe5Tbj0NJ7C7qPoa8?_a=BAMAMicg0"}},{"@type":"Comment","text":"The read numbers are real, but the part I’d sit with is what the model was never shown. It saw query text, so it optimized the one thing in front of it. Write cost, storage, index overlap across the workload were never on the table, so they were never priced. That’s not the model being wrong. It answered the question you handed it. The obligation “don’t regress the inserts” lived only in your head, so nothing could check it. Until write throughput and a storage budget are a check that can fail, a per-query recommendation keeps passing while the batch quietly gets slower.","datePublished":"2026-08-30T14:57:06.854Z","url":"https://daily.dev/posts/mTQeb2WZD#c-jhpSwksAS","author":{"@type":"Person","name":"Leonid Bugaev","url":"https://daily.dev/leonidbugaev","image":"https://lh3.googleusercontent.com/a/ACg8ocLhMgurwTmJElWaH9A8Ju8cHvZxgMCDt009jEYkmFCyUGAoaGSw=s96-c"}}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/i-let-ai-recommend-sql-server-indexes-across-a-week-of-queries-mtqeb2wzd#faq","mainEntity":[{"@type":"Question","name":"Can I trust an AI chatbot's SQL Server index recommendations without giving it the execution plan or existing indexes?","acceptedAnswer":{"@type":"Answer","text":"AI recommendations based only on query text and table definitions can be locally sensible but incomplete. In one tested week, six AI-suggested indexes cut logical reads by 86% and duration by 71%, but a combined insert batch of 20,000 orders and 60,000 order items took 2.9 times longer afterward, and index storage grew from 66MB to 170MB, none of which the model priced because it never saw the workload. Anyone weighing AI index suggestions against real write costs can compare notes and benchmarks on daily.dev."}},{"@type":"Question","name":"Why would an AI-recommended index that looks redundant actually not be redundant?","acceptedAnswer":{"@type":"Answer","text":"An index can look redundant because it shares a leftmost key column with an existing index, yet still be necessary if it returns a column the existing index does not include. In one case, a new index on CustomerID appeared redundant against an existing CustomerID, OrderDate index, but the new one also covered the Status column that the older index lacked, making it a legitimate covering index rather than pure duplication. Developers auditing overlapping indexes can dig into cases like this via daily.dev before dropping anything."}},{"@type":"Question","name":"Why did adding indexes based on AI recommendations slow down insert performance in SQL Server?","acceptedAnswer":{"@type":"Answer","text":"Each nonclustered index adds write overhead because SQL Server must update every index entry on every insert. In a tested batch of 20,000 new orders and 60,000 order items, insert time rose from 592ms with no nonclustered indexes to 1,703ms after seven AI-recommended indexes were added, a 2.9x slowdown that no query-only recommendation had accounted for. Teams balancing read speed against write cost can track index tradeoffs like this through daily.dev."}}]}
```

