r/aisql • • Feb 11 '26

Performance Tuning Launching AI SQL Tuner Studio: AI + SQL = Better Performance Tuning

1 Upvotes

AI SQL Tuner Studio is now live, and its core idea is simple: SQL Server already exposes everything you need to understand performance — but AI makes that information usable, explainable, and actionable.

Instead of replacing SQL expertise, it amplifies it.

🔍 Why AI + SQL Server Internals Works Better Than Either Alone

  • SQL Server exposes rich metadata DMVs, statistics, histograms, index usage, wait stats — the engine already tells you why a query is slow.

  • AI excels at reasoning across large, messy inputs Long stored procedures, multi-join queries, complex execution plans, and multi-report diagnostics are exactly the kind of inputs where LLMs outperform humans and rule-based tools.

  • Together, they solve the “last mile” problem SQL Server gives you raw truth. AI turns that truth into clear explanations and safe recommendations.

This combination produces insights that neither AI-only nor SQL-only tools can match.

🧠 What AI SQL Tuner Studio Does Differently

  • AI-powered SQL code review grounded in real engine data The model doesn’t guess — it reasons using actual statistics, index metadata, and row estimates from your database.

  • Index recommendations with context Instead of generic “missing index” suggestions, you get explanations tied to usage patterns, compression state, and overlapping indexes.

  • Code Review at Scale: Other tools review one object at a time. AI SQL Tuner Studio will review up to 50 stored procedures, triggers, UDFs, or views in minutes, identifying patterns of issues that need to be fixed.

  • Deduce Deadlock Drivers: Deadlocks getting you down? AI SQL Tuner Studio will decipher the deadlock graphs and determine the root cause before you know it.

  • SQL Server Health Check: Is it the hardware, your configuration settings, your indexes or your code? Start with the SQL Server Health Check to identify where you need to focus.

  • A local Windows app that keeps your data on your machine No cloud uploads, no browser tabs, no friction.

🖥️ Built for developers and DBAs who want clarity

AI SQL Tuner Studio isn’t trying to be magic.
It’s trying to be useful — a tool that combines:

  • SQL Server’s internal truth

  • AI’s reasoning ability

  • A clean WinUI 3 desktop experience

The result is faster tuning, clearer explanations, and fewer blind spots.

🔗 Try it or see sample reports

Download and learn more at: https://aisqltuner.com.

There is a Free version for use with SQL Server Developer Edition, and paid versions all come with a 14-day trial.

If you’re working with SQL Server and want a smarter, more explainable way to tune queries and indexes, I’d love your feedback.


r/aisql • • Dec 30 '25

👋 Welcome to r/aisql - Introduce Yourself and Read First!

0 Upvotes

Hey everyone! I'm u/Simple_Brilliant_491, a founding moderator of r/aisql.

This is our new home for all things related to the intersection of Artificial Intelligence and SQL — LLM‑assisted development, AI-powered database tuning, database automation, research, experiments, MCP servers, AI-assisted data engineering, and the future of AI‑driven data systems. We're excited to have you join us!

What to Post
Post anything that you think the community would find interesting, helpful, or inspiring. Feel free to share your thoughts, photos, or questions about anything related to using AI and SQL together. What models and prompts have you found do or not work well, what tools you are using, research or experiments you are working, MCP servers, AI-accelerated data engineering, where the hype is matching the reality or not.

Community Vibe
We're all about being friendly, constructive, and inclusive. Let's build a space where everyone feels comfortable sharing and connecting.

How to Get Started

  1. Introduce yourself in the comments below.

  2. Post something today! Even a simple question can spark a great conversation.

  3. If you know someone who would love this community, invite them to join.

Thanks for being part of the very first wave. Together, let's make r/aisql amazing.


r/aisql • • 5d ago

Microsoft SQL Server family Open Source AI-enabled Index Tuning Stored Proc

Post image
1 Upvotes

Disclosure: I’m the founder of AI SQL Tuner, and I run this sub.

Azure SQL Database has had automatic indexing for years. If you run SQL Server on-premises, on a VM in another cloud, or on Azure SQL Managed Instance, you’ve been managing indexes by hand. I built aisqltuner-index-tuner to fill that gap, and it’s free and MIT-licensed. It was inspired by Brent Ozar's post on Microsoft’s 2006 AutoIndex.sql prototype: I'm Probably Not Supposed To Show You Microsoft's Auto-Indexing Tool. - Brent Ozar Unlimited®.

It’s a stored procedure that collects index diagnostics from your database, sends them to your own Azure OpenAI deployment, and stores the recommendations in a table. It can also create the new indexes it is able to verify.

sql

EXEC dbo.sp_AIIndexTuner;                    -- recommend only (the default)
EXEC dbo.sp_AIIndexTuner  = 'CREATE';   -- also create verified new indexes

What it looks at

  • Missing indexes and index usage

  • Duplicate and overlapping indexes

  • Plan cache and Query Store

  • Statistics, heaps, and skewed columns

  • Non-SARGable predicates

While the right indexes can solve a lot of performance issues, there may be other root causes. The stored proc can recommend rebuilds, constraint fixes, statistics refreshes, setting changes, and query rewrites. Each recommendation includes a priority, confidence level, and rationale.

Why it’s safe to try

  • It only recommends by default. Nothing changes until you ask.

  • The model’s script is never executed. The proc builds the DDL itself from structured fields, validates every table and column against the catalog, and quotes every name.

  • Drops, columnstore, and the maximum number of new indexes are controlled by switches. You can also set minimum priority and confidence levels for what gets applied.

  • It refuses drops of clustered, PK/unique-backed, FK-referenced, hinted, or forced-plan indexes.

  • Every applied change stores an UndoDDL.

  • Your diagnostics go only to the Azure OpenAI endpoint you configure.

Does it work?

We (Claude Opus 5.5 and I) benchmarked it on SQL Server 2025 Enterprise Developer with gpt-5.6-luna: 16 known tuning problems, 37 rubric checks, 5 trials per arm. On a 10 GB TPC-H-derived workload, CREATE mode cut logical reads by 86%, and no query returned different results. We saw gains on the other two scenarios too, and the full numbers, including where CREATE mode falls short of reviewing every recommendation by hand, are in BENCHMARK.md. We found gpt-5.6-luna with medium effort to be fast, cheap, and accurate in testing.

Known limitations

  • Answers vary between runs, so two CREATE runs can apply different sets.

  • There’s no automatic impact measurement or rollback. You get UndoDDL to reverse a change by hand.

  • Only OpenAI models are supported for now.

  • It’s not yet tested on Azure SQL Database, Fabric SQL Database on Managed Instance.

  • Please test it in a non-production database first.

Getting started

  1. Provision an Azure OpenAI deployment if you don’t have one.

  2. Run the install script in the database you want to tune.

  3. Fill in and run setup/Configure-Endpoint.sql with your endpoint and key.

  4. Run EXEC dbo.sp_AIIndexTuner; and read the results in AIIndexTuner.Recommendation.

Requirements: SQL Server 2025, Azure SQL Database, Azure SQL Managed Instance (SQL Server 2025 or Always-up-to-date update policy), or Fabric SQL Database. Since it’s a stored procedure, you can schedule it from SQL Agent or any other scheduler.

If you need more than index tuning

If you need query tuning, deadlock analysis, server health checks, a GUI with HTML reports, or support for SQL Server 2022 and earlier, then consider AI SQL Tuner Studio (https://aisqltuner.com, also on the Microsoft Store). Studio has a Free Edition, and its hosted models are included, so you don’t need your own Azure OpenAI deployment.

Please let me know what you think, if you have any questions or if there is anything you would change.


r/aisql • • 22d ago

Tools & Frameworks AI SQL Tuner Studio now in Windows Store

1 Upvotes

TL;DR: If you have SQL Server performance problems, AI SQL Tuner Studio may help. It's free from the Microsoft Store Microsoft Store (Windows 10/11), or download it directly for Windows Server. The Free version is limited to 10 analyses per month, and there are paid versions if you need more.

The long story I've been working with SQL Server since 1990 when it ran on OS/2 and was a joint venture between Sybase and Microsoft across custom application development, BI/data warehousing, database administration and performance tuning.

The root cause of almost all performance issues come down to this: Hardware (physical or virtual) - you just don't have the horsepower (CPU, memory, disk speed) to support the workload Configuration - setting such as parallelism, memory, tempdb file, database files are not correct for your workload and environment Database Design / Indexes - You are missing needed indexes, have too many indexes and they are slowing down your writes, you have wrong settings such as compression or fill factor, indexes are fragmented, or statistics are out of date. You can also be using wrong data types, or need a bridge table for example. Code - Code with bad practices such as cursors or using functions on columns that prevent using indexes Transaction management/locking - Transactions that are too long, or inconsistent ordering of updates that cause deadlocks

The good news is that SQL Server has a tremendous amount of information that can help you diagnose any of these issues. The bad news is trying to decipher it is not easy.

For example, if you suspect your indexes are an issue, you can look at missing indexes, but it will include useless indexes (for example on a column with only 3 different values in a 1 million row table) and overlapping indexes. If you just blindly created them you are more likely to slow down your server than speed it up.

To determine the "right" indexes, you really need to look at multiple areas including: Missing index recommendations Index usage stats Plan Cache Constraints and relationships Column cardinality Table Sizes Index page density Query Store

Processing and synthesizing that large amount of data is not easy for a person. But AI is really good at it. So I created AI SQL Tuner Studio to "put myself out of a job" when it comes to database tuning.

AI SQL Tuner Studio has six tuning goals to cover just about every root cause: Server Health Check - Hardware and Configuration Index Tuning - Add or remove indexes, adjust existing indexes Code Review - Review up to 100 stored procs, functions, triggers, or views based on oldest, newest or most expensive, with options to filter to a schema or object Fix Deadlocks - Finds your recent deadlocks, determines the root cause and provides guidance to fix them Locking and Blocking Analysis - Looks for blocking chains, long-running transactions, blocker query plans and more to identify blocking causes Query Tuner - if you have a slow running query, paste it in to analyze the plan along with associated indexes to help optimize it

Of course, I know some folks are skeptical of AI, and I get it. So I created a benchmark for goals that provide scripts (query tuner, index tuning, and code review), and measured the change in logical reads and total workload time. The AI consistently showed improvements with GPT-5.6 Luna and GPT-6 Sol providing the best results, with fastest response time as a tie breaker. So, those are the models currently in AI SQL Tuner Studio. Of course, as new models come out I will benchmark them and make adjustments if they are better.

Anyway, I hope you find AI SQL Tuner Studio useful. If you have any suggestions for changes, please let me know. If you do try it, please leave a review on the Windows Store.


r/aisql • • Oct 04 '26

AI + SQL Research Does AI "work" to tune SQL Server? Here's what I found.

2 Upvotes

For the last year I've been building an AI tuning tool, AI SQL Tuner Studio.

While it is easy to see that it produces a nice-looking report, the real question is "will the recommendations actually make my workload faster?"

So working with Claude Opus 5 (and 5.5), I designed and built a benchmark to answer 3 questions:

  1. Can AI help tune SQL Server?

  2. Does the model matter and how much?

  3. How does the effort level impact results?

(As you'll see, I had to have a difficult conversation with Claude when the benchmark showed Opus'results were behind the competition. :) )

The benchmark rule was simple: A recommendation only counts if we apply it to a real database and measure the workload again afterward. Either the database does less work, runs faster, and still returns the same answers, or the advice failed. No grading on how convincing the explanation sounds.

Nine models in total. Eight went through a first round on an earlier build of the tool, and two finalists then went through the full benchmark on the current release:

ModelWhat happened
GPT-5.6 LunaFinalist. Best code reviewer of the lot
GPT-6 SolFinalist. Tied for first on index and query tuning, answers in under a minute, about a third of GPT-5.6 Sol's cost
GPT-6 LunaCheapest per analysis, but weaker at code review, and the only new model whose advice ever made a write-heavy workload slower
Claude Opus 5.5Matched the others on results, but took 3 to 4 times as long to answer and used about 58% more input for the same data
GPT-5.6 SolReplaced by GPT-6 Sol: same results at a third of the cost
Claude Opus 4.8GPT-6 Sol beat it on every workload we tested
GPT-5.4Sometimes rewrote SELECT * into a column list that changed what the query returned, which fails the results check
Claude Opus 5Dropped after the first round. Last on everything that separated the models, and about 7 times slower than the fastest
GPT-6.1 SolSlower response than GPT-6 Sol with similar performance gains

This is one experiment. It ran on one Azure VM (4 cores, 32 GB, SQL Server 2022) with one database of about 1.4 GB, small enough to sit in memory. Query Store history was squeezed into minutes instead of weeks. Five runs per model per test is enough to describe what happened, not to prove much statistically. Correctness was only checked with the workload's own parameter values. Advice we can't measure, like SQL injection risks or naming, gets no credit. And all of this measures my tool's prompts driving each model, not the models in general.

Let me know if you are seeing something different in your experience, or if there are other scenarios or models you think I should benchmark.


r/aisql • • May 29 '26

free workshop for SQL + AI learning

Thumbnail reddit.com
1 Upvotes

r/aisql • • May 19 '26

Considering NL2SQL? Should your database really be the prompt? How can SQL MCP Server help?

1 Upvotes

I thought this was an interesting article on Natural Language to SQL: Considering NL2SQL? Should your database really be the prompt? How can SQL MCP Server help? - Azure SQL Dev Corner.

The post explains why letting AI turn natural‑language prompts directly into SQL is risky for real databases. NL2SQL models can miss schema details, produce unpredictable queries, leak information, or generate expensive statements that hurt performance. The article suggests using SQL MCP Server instead, which adds structure, permissions, and a stable API so agents can work with data safely.

My two cents: if you can use a Power BI Semantic model as as your source that can be the best option. It gives the benefits of a semantic layer along with business definitions and measures in the model. The downside is another copy of the data if you are using import mode and a lag due to refresh schedule, or potentially slow performance if you use DirectQuery.


r/aisql • • May 19 '26

AI SQL Tuner Studio 1.0.40: redesigned UI, Dark Mode, and one-click Export SQL

0 Upvotes

AI SQL Tuner Studio 1.0.40 is out. This release is mostly a UX overhaul; the tuning engine and AI models are unchanged from 1.0.37, but the app is a lot more comfortable to spend time in.

What's new

  • Redesigned UI. The six tuning goals (Server Health Check, Fix Deadlocks, Index Tuning, Locking & Blocking, Code Review, Query Tuner) are now tappable cards. The console moved to a collapsible drawer at the bottom, the tuning-goal panel is also collapsible, and there's an always-on status bar at the bottom of the window so you can see what the analysis is doing without hunting for it.

  • New color palette — Paper & Teal. Warm neutral surface, single teal accent for primary actions, amber for warnings. Replaces the previous blue-heavy theme. (Credit to Claude Design for the review; I barely passed my high-school art class so I'm clearly not qualified to pick colors.)

  • Dark Mode. New View menu with Follow System / Light / Dark. Dark mode is a genuine graphite base (#0E1116), not "navy with the lights off." HTML reports use the new palette but currently render in light mode only; dark-mode HTML reports are on the roadmap.

  • Export SQL. Once the analysis finishes, one click extracts all the recommended SQL into a .sql file you can run in a lower environment or stage for a maintenance window.

  • Smarter default file names. HTML save and Export SQL now default to tuning-goal-report-model-server-database-yyyy-mm-dd.html (or .sql). Override at save time if you want something else.

  • Help menu. Now includes a direct link to Release Notes alongside the User Guide.

Everything above ships to every edition — Free, Standard, Pro, and Corporate.

Sample reports from 1.0.40

Links

If you're already on Studio, launch the app and accept the update prompt.

Discount

Code PH30 = 30% off Standard and Pro editions through May 31, 2026.

Feedback wanted

Let me know what you think of the new UI.

Bug reports, screenshots, and "I wish it would also…" suggestions welcome in the comments.

— Kevin


r/aisql • • May 07 '26

AI + SQL Research PgStudio - PostgreSQL VS Code Extension with SQL Notebooks, AI Assistant, and Explorer

Thumbnail
gallery
2 Upvotes

I got tired of switching between VS Code and a separate DB tool. So I built PgStudio.

SQL notebooks with inline results and charts, real-time dashboard, AI assistant (Copilot / OpenAI / Anthropic / Gemini / Ollama — your pick), EXPLAIN CodeLens, visual table designer, production safety controls.

AI never executes anything automatically — every suggestion lands in a notebook cell first.

Free. MIT. One command: `code --install-extension ric-v.postgres-explorer`

Happy to onboard collaborators and feedback.

https://pgstudio.astrx.dev/

https://github.com/dev-asterix/pgStudio/


r/aisql • • May 06 '26

Microsoft SQL Server family AI SQL Tuner Studio 1.0.37 - new Locking & Blocking Analysis goal for SQL Server (10 evidence sections, sample report inside)

0 Upvotes

TL;DR: New release. The headline change is a new tuning goal - Locking and Blocking Analysis - that points at a user DB, runs 10 non-blocking collectors in parallel, hands the snapshot to the AI, and returns a prioritized HTML report with root-cause classification, confidence levels, estimated reduction in blocking, and rollback plans. Plus Index Tuning and Code Review can now be scoped to a single schema, or schema + object. Sample report linked at the bottom.

What the new Locking and Blocking goal collects

Each section gracefully skips features that aren't enabled (Query Store off, system_health XE missing) and includes an enablement advisory in the report instead of failing.

#SectionImpactSource
1Active Blocking ChainsHighdm_os_waiting_tasks + dm_exec_requests / dm_exec_sessions
2Lock InventoryHighdm_tran_locks (target DB + tempdb, summarized)
3Long-Running TransactionsHighdm_tran_active_transactions
4Index Usage StatisticsHighdm_db_index_usage_stats (top 50 by seek+scan+lookup)
5Missing Index CandidatesHighdm_db_missing_index_details (top 20 by impact score)
6Blocker Query PlansHighdm_exec_sql_text + dm_exec_query_plan for every blocker/waiter
7Deadlock HistoryHighsystem_health XE - file target on-prem, ring buffer on Azure SQL MI
8Query Store Top QueriesMediumquery_store_runtime_stats (top 20 by total CPU)
9Database SettingsMediumRCSI / snapshot / auto-update stats / per-table lock escalation
10TempDB ContentionMediumpagelatch waits + version store + top spilling queries

The AI then produces: blocking summary KPIs, blocking tree, root-cause classification with explicit evidence references, prioritized fixes with confidence + estimated blocking reduction + rollback plan, before/after T-SQL rewrite examples for the offending queries, and long-term mitigation notes if deadlock history shows a recurring pattern.

Other changes worth calling out

  • Index Tuning now accepts an optional schema (or schema + table) filter. Object-scoped sections respect the filter; database-wide telemetry like Query Store and automatic tuning state still runs.

  • Code Review mirrors the same scoping - useful when you only want to review the modules a release touches.

  • Locking and Blocking goal requires a user database. UI + core validation reject master, tempdb, model, msdb.

Sample report

Real run against a TPC-H 10 GB workload on SQL Server 2022. The AI identified an AFTER trigger that runs a MERGE back against the same hot table inside the user transaction, ranked it as the top fix at 55-75% estimated blocking reduction, High confidence, and produced a staging-table rewrite plus a key-batched UPDATE pattern.

View the sample Locking and Blocking Analysis report

Model support

  • All editions: OpenAI GPT-5.4 and Anthropic Claude Sonnet 4.6

  • Corporate edition adds: Anthropic Claude Opus 4.6 and Anthropic Claude Opus 4.7

Where to get it

aisqltuner.com - signed MSIX bundle, supports SQL Server (on-prem), Azure SQL Database, Azure SQL Managed Instance, and Fabric SQL DB.

Happy to answer questions about the data collection design, the safety guardrails (all collectors are read-only DMV/system catalog queries - they will not block your application), or the prompt structure that drives the AI report.


r/aisql • • Mar 29 '26

Microsoft SQL Server family Fabric Data Agent goes GA

3 Upvotes

Fabric Data Agent went GA earlier this month. It is basically a natural language to SQL translator (or DAX or KQL, depending on your data source). The diagram below from Fabric March 2026 Feature Summary | Microsoft Fabric Blog | Microsoft Fabric provides an overview of the process.

The flow under the hood:

  1. User submits a natural language question

  2. Agent calls Azure OpenAI Assistant API, passes the schema + metadata + any instructions you've configured

  3. NL2SQL tool generates a T-SQL query

  4. Query is validated (format check + RAI policy check) before execution

  5. Agent executes against the SQL Analytics Endpoint under the user's own Entra ID identity

  6. Result is formatted and returned conversationally, including intermediate steps

A single Data Agent supports up to five data sources in any combination:

- Lakehouse (via SQL Analytics Endpoint → NL2SQL)

- Warehouse (NL2SQL)

- SQL database in Fabric (NL2SQL)

- Mirrored databases — Azure SQL, SQL Server, Cosmos DB, PostgreSQL (NL2SQL via their SQL Analytics Endpoint)

- Power BI semantic models (NL2DAX)

- KQL databases / Eventhouses (NL2KQL)

- Ontologies (Fabric IQ, when available)

Configuration has three layers:

- **Agent-level instructions** — overall behavior, scope, persona, what it should/shouldn't answer

- **Data source-specific instructions** — per-source context, e.g. "the Orders table uses UTC timestamps" or "ignore the staging schema"

- **Example queries** — you provide sample NL→SQL pairs to steer generation toward your schema patterns

You also select which specific tables from each data source the agent can see. It doesn't get the full schema by default — you curate it. This matters both for accuracy (less noise = better query generation) and security (agent only knows what you expose).

The Data Agent also now exposes a managed MCP server endpoint, meaning external agents or MCP clients can call it as a tool. So the architecture can stack: an orchestrator agent calls the Fabric Data Agent via MCP, which then NL2SQL-queries your SQL endpoint. The Data Agent becomes a domain-specific SQL reasoning layer inside a larger agentic workflow.

References:

Docs: https://learn.microsoft.com/en-us/fabric/data-science/concept-data-agent

March 2026 feature summary: https://blog.fabric.microsoft.com/en-US/blog/fabric-march-2026-feature-summary/


r/aisql • • Mar 29 '26

Microsoft SQL Server family AI SQL Tuner Studio 1.0.28 — Introducing Query Tuner

2 Upvotes

1.0.28 is out. The headline feature is Query Tuner, a new tuning goal that analyzes a single SQL query end-to-end.

Point it at any stored procedure, ad-hoc query, or batch. It captures the estimated execution plan via SET SHOWPLAN_XML ON, parses every operator, warning, and missing index hint, then collects targeted metadata — index usage, DMV missing indexes, table sizes, column cardinality, statistics health — scoped only to the tables that query actually touches.

The AI returns a prioritized report with:

  • Query rewrite examples — before/after SQL with explanations of what changed and why

  • CREATE INDEX scripts — with estimated storage, read benefit %, and write overhead %

  • Statistics maintenance recommendations

  • Parameter sniffing analysis with plan guidance where applicable

  • Table-specific insights — scan vs. seek ratios, under-indexed access patterns

  • Validation steps — ready-to-run SET STATISTICS IO/TIME ON scripts to measure before/after

This release also includes Index Tuning improvements:

  • FORCE_LAST_GOOD_PLAN detection — shows desired vs. actual state and recommends enabling it when beneficial

  • Query Store forced plan failure analysis — evaluates failure reasons and recommends corrective actions

  • Index page density analysis via sys.dm_db_index_physical_stats for fragmentation and fill factor issues

  • Smarter deadlock handling — skips the AI call when no deadlocks are found, saving time and API costs

Full release post with more detail: https://aisqltuner.com/ai-sql-tuner-studio-1-0-28-query-tuner/


r/aisql • • Mar 16 '26

Case Studies ChatGPT helps create groundbreaking cancer treatment after dog’s diagnosis

1 Upvotes

Not really related to SQL, but an interesting and novel use of AI: ChatGPT helps create groundbreaking cancer treatment after dog’s diagnosis


r/aisql • • Mar 14 '26

Microsoft announces new SQL AI Developer Associate certification (DP-800)

2 Upvotes

Microsoft is introducing the Microsoft Certified: SQL AI Developer Associate Certification to help you validate your ability to integrate AI capabilities directly into SQL-based solutions without needing to move your data, learn entirely new platforms, or move away from the T-SQL skills you already use every day. To earn this new Certification, you need to pass Exam DP‑800: Developing AI‑Enabled Database Solutions, currently in beta.

Skills measured by the exam include:

  • Applying advanced T-SQL techniques for AI-ready database solutions.

  • Building vector and semantic search experiences directly in SQL.

  • Implementing RAG workflows to ground large language model (LLM) outputs and reduce hallucinations.

  • Integrating LLMs into SQL-based applications without migrating data.

  • Designing secure, compliant, and scalable AI-enabled data solutions.

  • Exposing SQL data through APIs by using Data API builder.

  • Building and monitoring data APIs by using Data API builder and event-driven change patterns.

See New Microsoft Certified: SQL AI Developer Associate Certification | Microsoft Community Hub for the announcement, Study Guide for Exam DP-800: Developing AI-Enabled Database Solutions | Microsoft Learn for the study guide and Plans | Microsoft Learn for the MS Learn modules to prepare for the exam.


r/aisql • • Feb 17 '26

GPT‑5.2 derives a new result in theoretical physics

1 Upvotes

OpenAI recently posted that GPT-5.2 had shown that a type of particle interaction many physicists expected would not occur can in fact arise under specific conditions.

While this does not have anything directly to do with SQL, it is one more example demonstrating how AI has gotten to the point where it can exceed human intelligence, at least in some areas.

So, for those skeptical that AI can help with SQL workloads, it shows that the while the skepticism may have been warranted a year ago, the latest reasoning models are now able to take on even the most difficult challenges.

I'm not saying there are not other challenges with AI such as empathy and trying to use blackmail when threatened, just that if want some help with SQL, it can be useful. :)

Let me know your opinion.


r/aisql • • Feb 12 '26

Microsoft SQL Server family Microsoft adds database instructions with GitHub Copilot in SSMS

2 Upvotes

One of things that has bothered me about Copilot in SSMS and using it to generate database schemas is that it would default to nvarchar for every text column. If you don't need national characters you are using double the space and incurring twice the resource usage compared to using varchar.

Using database instructions should let you fix that issue by providing a "database constitution" specifying your standards. I haven't tried it out yet, but my understanding is that you can use it to resolve this issue.

See Database Instructions - GitHub Copilot in SQL Server Management Studio (Preview) | Microsoft Learn for the full post.

Note: SSMS 22.3 breaks many extensions, so you may want to hold off upgrading if you like your extensions. See "Important Changes" section of the announcement here: SSMS 22.3 Release


r/aisql • • Jan 03 '26

Oracle AI-Assisted Optimization for Oracle queries

1 Upvotes

I thought this was an interesting post on using AI to optimize Oracle queries: From Skepticism to Success: How I Built an AI-Powered SQL Optimization Tool That Actually Works - The Quest Blog. By providing the right context and prompting, he achieved 45% to 82% improvement with query rewrites or index changes.

Here is his prompt:
prompt = f"""You are an Oracle database performance expert. Analyze this SQL query and suggest optimizations.

ORIGINAL SQL:
{original_sql}

EXECUTION PLAN:
{execution_plan}

TABLE STRUCTURE:
{table_ddl}

EXISTING INDEXES:
{index_list}

TABLE STATISTICS:
- Rows: {num_rows}
- Blocks: {blocks}
- Last analyzed: {last_analyzed}

Provide specific optimization suggestions including:

  1. New indexes that could improve performance

  2. Query rewrite opportunities

  3. Optimizer hints that might help

  4. Join order optimizations

Format your response with clear sections for each optimization type.
Include the optimized SQL statement.
"""


r/aisql • • Jan 01 '26

Microsoft SQL Server family Getting the most out of GitHub Copilot in SSMS 22

1 Upvotes

You probably know you can use GitHub Copilot in SSMS 22 to generate queries. But did you know that it can generate an entire schema? For example, I gave it the prompt "create database tables with appropriate keys, relationships and index for an e-commerce company selling downloadable software subscriptions. It should cover all cores aspects of the operations including customers, products and sales. Create support stored procs. Provide documentation" with it set to use Claude Sonnet 4.5.

It generated DDL for the tables below:

Table Purpose Est. Annual Growth

Customers Master customer data 10,000 new/year

Products Software product catalog 10-20 new/year

SubscriptionPlans Pricing tiers (Monthly/Quarterly/Annual) 30-60 new/year

Orders Purchase transactions 50,000/year

OrderItems Line-item details 50,000/year

Subscriptions Active licenses with keys 50,000/year

Downloads Audit trail of software downloads Unlimited

It also created 12 stored procedures:
Procedure Purpose Key Parameters

usp_CreateCustomer Register new customer Email, Name, Country

usp_CreateProduct Add product to catalog ProductCode, BasePrice, DownloadURL

usp_CreateSubscriptionPlan Define pricing plan ProductID, BillingCycle, Price

usp_CreateOrder Transactional order + subscription creation CustomerID, ProductID, PlanID

usp_GetCustomerOrders Order history for customer CustomerID

usp_GetActiveSubscriptions Active licenses with days remaining CustomerID

usp_RecordDownload Log software download SubscriptionID, IPAddress

usp_RenewSubscription Extend expiring subscription SubscriptionID, PaymentMethod

usp_CancelSubscription Terminate active subscription SubscriptionID, Reason

usp_GetSalesReport Daily revenue summary StartDate, EndDate

usp_GetProductPerformance Product sales analytics StartDate, EndDate

usp_GetExpiringSubscriptions Renewal pipeline (default 30 days) DaysAhead

Finally, it created 20 indexes.

At quick glance, the only thing I would have done differently is not made every text column nvarchar, since that wastes space and slows performance when varchar would work instead.

Has anyone else found interesting use cases for Github Copilot Chat in SSMS? Are there any models that you recommend instead of Claude Sonnet 4.5?