SQL Server 2025 Fundamentals: A Practical Guide from Basics to Advanced
- What SQL Server 2025 Fundamentals Means
- What Is Actually New in SQL Server 2025
- Database and File Architecture
- Tables, Data Types, and Constraints
- Indexes and Performance Basics
- Optimized Locking: The Concurrency Game Changer
- Vector Search and AI Fundamentals
- Native JSON and RegEx
- Query Execution and Optimization
- Security Fundamentals
- Backup and Recovery
- Pros and Cons
- Hands-On Workshop
- Final Thoughts
- References
SQL Server 2025 is a genuine step change — not a maintenance release. While it preserves everything DBAs and developers rely on, it adds features that would have seemed far-fetched in earlier versions: native vector search, AI model integration directly in T-SQL, built-in regular expressions, a native JSON data type, and a locking overhaul that can improve concurrency with no code changes required.
This article focuses on fundamentals — not just what SQL Server 2025 is, but how to actually use it. We cover the core concepts every SQL professional needs, explain what is genuinely new to 2025, and include a hands-on workshop that scales from novice to advanced.
What SQL Server 2025 Fundamentals Means
At its core, SQL Server 2025 is a relational database management system designed to store, retrieve, secure, and analyze structured data. Fundamentals are the concepts every SQL professional should understand before moving into advanced architecture or tuning:
- Database and file architecture
- Tables, indexes, and constraints
- Query execution and optimization
- Security and permissions
- Backup, recovery, and reliability
- The new 2025-specific features that extend all of the above
Understanding these well is what separates someone who can write queries from someone who can run production systems. SQL Server 2025 is powerful, but it rewards good fundamentals and punishes shortcuts — exactly as every version before it did.
What Is Actually New in SQL Server 2025
The original article described SQL Server 2025 as having “improved query intelligence and better hybrid scenarios” — which is accurate but significantly understates what actually shipped. Here is what is genuinely new:
Native VECTOR Data Type + DiskANN
Store vector embeddings directly alongside relational data. Query semantic similarity in T-SQL using the DiskANN approximate nearest neighbor index. Enables RAG patterns without a separate vector database.
Optimized Locking (TID + LAQ)
Transaction ID locking and Lock After Qualification reduce lock memory consumption and minimize blocking for concurrent DML — no code changes required. Enable per database.
Native JSON Data Type
A dedicated JSON type (up to 2 GB per row) with proper indexing. No more treating JSON as glorified NVARCHAR. Significantly faster storage and querying of semi-structured data.
Built-in RegEx
Regular expressions natively in T-SQL — no CLR, no workarounds. Pattern matching and extraction that previously required external code or complex LIKE patterns.
AI Model Integration in T-SQL
Define AI models in T-SQL and call Azure OpenAI, Azure AI Foundry, Ollama, and others via sp_invoke_external_rest_endpoint. Generate embeddings with AI_GENERATE_EMBEDDINGS().
ZSTD Backup Compression
Zstandard compression — faster and smaller than previous options. Full and differential backups can now run on secondary AG replicas, reducing primary workload.
Change Event Streaming
Near-real-time change data to Azure Event Hubs and Kafka without complex ETL pipelines. Enables event-driven architectures directly from the SQL Server engine.
TDS 8.0 + TLS 1.3 by Default
Encryption mandatory for all connections. PBKDF2 password hashing, login-specific security cache, and full Microsoft Entra managed identity support.
Many AI and vector features require opting in via PREVIEW_FEATURES at the database scope: ALTER DATABASE YourDB SET PREVIEW_FEATURES = ON. Use this to evaluate experimental innovations before they are promoted in a cumulative update.
Database and File Architecture
Every SQL Server database consists of data files and transaction log files. This separation is foundational to performance and recovery — and unchanged in SQL Server 2025.
CREATE DATABASE SalesDB
ON PRIMARY
(
NAME = SalesDB_Data,
FILENAME = 'C:\SQLData\SalesDB_Data.mdf',
SIZE = 1GB,
FILEGROWTH = 256MB
)
LOG ON
(
NAME = SalesDB_Log,
FILENAME = 'C:\SQLLogs\SalesDB_Log.ldf',
SIZE = 512MB,
FILEGROWTH = 128MB
);
Fundamental takeaway: Data files store tables and indexes. Log files record every change before it is applied. This separation is what makes point-in-time recovery possible. Pre-size both files — never let them grow in small increments. Frequent autogrowth events cause fragmentation and stalls.
Tables, Data Types, and Constraints
SQL Server 2025 expands the type system significantly with native JSON and VECTOR types, but the relational fundamentals are unchanged. Constraints protect data integrity and give the optimizer execution plan guarantees.
-- Standard table with constraints and defaults
CREATE TABLE dbo.Customers
(
CustomerID INT IDENTITY(1,1) PRIMARY KEY,
FirstName NVARCHAR(100) NOT NULL,
LastName NVARCHAR(100) NOT NULL,
Email NVARCHAR(255) UNIQUE,
CreatedDate DATETIME2 NOT NULL DEFAULT SYSDATETIME()
);
-- SQL Server 2025: native JSON column alongside relational columns
ALTER TABLE dbo.Customers
ADD Preferences JSON NULL;
Constraints are not optional. A UNIQUE constraint tells the optimizer a seek on that column returns at most one row. A CHECK constraint tells it which values are valid. These guarantees directly improve execution plan quality — use them.
Indexes and Performance Basics
Indexes are the single most impactful performance feature in SQL Server. The rule is unchanged: indexes speed up reads but slow down writes. Every index must earn its place.
-- Standard nonclustered index
CREATE NONCLUSTERED INDEX IX_Customers_Email
ON dbo.Customers (Email);
-- Composite index: equality predicates first, range second, covering includes
CREATE NONCLUSTERED INDEX IX_Orders_Status_Date
ON dbo.Orders (Status, OrderDate)
INCLUDE (CustomerID, TotalAmount);
-- SQL Server 2025: DiskANN vector index for semantic similarity search
-- Requires PREVIEW_FEATURES = ON
CREATE VECTOR INDEX IX_Articles_Embedding
ON dbo.Articles (Embedding)
WITH (METRIC = 'cosine', TYPE = 'diskann');
Optimized Locking: The Concurrency Game Changer New in 2025
This is one of the most significant engine improvements in SQL Server 2025 for production OLTP systems. It uses two mechanisms to reduce blocking in concurrent write workloads — with no application code changes required.
| Mechanism | How It Works | Impact |
|---|---|---|
| TID Locking | Tracks row ownership via a lightweight Transaction ID instead of acquiring row and page locks. Other sessions wait on the TID rather than the row lock. | Lower lock memory consumption. Reduced blocking chains on high-concurrency tables. |
| LAQ (Lock After Qualification) | Locks are acquired only after a row passes the WHERE clause — rows that don’t match are never locked. | Fewer unnecessary locks on scans that filter most rows. Less contention for read/write overlap. |
-- Enable Optimized Locking on a database (SQL Server 2025)
ALTER DATABASE [YourDatabase] SET OPTIMIZED_LOCKING = ON;
-- Verify
SELECT name, is_optimized_locking_on
FROM sys.databases WHERE name = 'YourDatabase';
DBAs report significant real-world improvements with Optimized Locking in high-concurrency environments — particularly for workloads using readable AG secondaries. Test in non-production first, especially if you use locking hints. For most standard OLTP workloads it is a safe, impactful improvement.
Vector Search and AI Fundamentals New in 2025
SQL Server 2025 turns the database engine into a native vector store, enabling semantic search — finding rows similar in meaning rather than exact keyword matches — without a separate vector database service.
A vector embedding is a list of floating-point numbers generated by an AI model that represents the meaning of text, images, or other data. Similar concepts produce numerically close vectors. SQL Server 2025 stores these in a VECTOR column and indexes them with DiskANN for fast similarity queries.
-- Enable preview features (required for vector search)
ALTER DATABASE [YourDatabase] SET PREVIEW_FEATURES = ON;
GO
-- Table with a VECTOR column (1536 dimensions = OpenAI text-embedding-3-small)
CREATE TABLE dbo.Articles
(
ArticleID INT IDENTITY(1,1) PRIMARY KEY,
Title NVARCHAR(200) NOT NULL,
Content NVARCHAR(MAX) NULL,
Embedding VECTOR(1536) NULL
);
-- Define an AI model for embedding generation (Azure OpenAI example)
CREATE EXTERNAL MODEL MyEmbeddingModel
WITH
(
LOCATION = 'https://your-resource.openai.azure.com/',
API_FORMAT = 'Azure OpenAI',
MODEL_NAME = 'text-embedding-3-small',
CREDENTIAL = MyAzureOpenAICredential
);
-- Generate and store embeddings in T-SQL
UPDATE dbo.Articles
SET Embedding = AI_GENERATE_EMBEDDINGS(Content USE MODEL MyEmbeddingModel)
WHERE Embedding IS NULL;
-- Create DiskANN vector index
CREATE VECTOR INDEX IX_Articles_Embedding
ON dbo.Articles (Embedding)
WITH (METRIC = 'cosine', TYPE = 'diskann');
-- Semantic similarity query: find articles similar to a search phrase
DECLARE @Query VECTOR(1536) =
AI_GENERATE_EMBEDDINGS(N'How neural networks work' USE MODEL MyEmbeddingModel);
SELECT TOP 5
ArticleID, Title,
VECTOR_DISTANCE('cosine', Embedding, @Query) AS similarity_score
FROM dbo.Articles
ORDER BY similarity_score ASC; -- Lower cosine distance = more similar
You do not need vector search to benefit from SQL Server 2025. These features are entirely opt-in. Most production systems will continue using traditional indexes, constraints, and relational query patterns that have not changed. Vector search adds to the toolbox — it does not replace the fundamentals.
Native JSON and RegEx New in 2025
Native JSON Type
-- Native JSON column -- dedicated storage type, not NVARCHAR
CREATE TABLE dbo.UserProfiles
(
UserID INT PRIMARY KEY,
ProfileData JSON NOT NULL
);
-- Query JSON data
SELECT
UserID,
JSON_VALUE(ProfileData, '$.theme') AS theme,
JSON_QUERY(ProfileData, '$.permissions') AS permissions
FROM dbo.UserProfiles
WHERE JSON_VALUE(ProfileData, '$.role') = 'admin';
Built-in Regular Expressions
-- REGEXP_LIKE: test string against a regex pattern
SELECT CustomerID, Email
FROM dbo.Customers
WHERE REGEXP_LIKE(Email, '^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$') = 1;
-- REGEXP_SUBSTR: extract a matched substring
SELECT OrderID, REGEXP_SUBSTR(ReferenceCode, '[A-Z]{2}\d{6}') AS extracted_code
FROM dbo.Orders;
Query Execution and Optimization
When you run a query, SQL Server generates an execution plan. SQL Server 2025 continues the Intelligent Query Processing improvements from 2022 and adds several new mechanisms:
- Cardinality Estimation (CE) feedback for expressions — the optimizer learns from past executions and adjusts estimates for complex expressions
- Optional Parameter Plan Optimization (OPPO) — runtime-based plan selection to address parameter sniffing issues
- Query Store on readable secondaries — captures workload on AG secondaries, not just the primary
- Optimized
sp_executesql— reduces compilation storms from large dynamic SQL workloads
-- A query whose performance depends entirely on having the right index
SELECT CustomerID, FirstName, LastName
FROM dbo.Customers
WHERE Email = 'user@example.com';
-- If this is slow: check the execution plan
-- Seek = index used correctly
-- Scan = full table scan -- add or fix an index before scaling hardware
Security Fundamentals
SQL Server 2025 enforces TDS 8.0 and TLS 1.3 by default for all connections. PBKDF2 replaces older password hashing. Microsoft Entra managed identity is fully supported. The principle of least privilege remains as important as ever.
-- Minimal-privilege application login
CREATE LOGIN AppUser
WITH PASSWORD = 'StrongPassword!123',
CHECK_POLICY = ON,
CHECK_EXPIRATION = ON;
CREATE USER AppUser FOR LOGIN AppUser;
GRANT SELECT, INSERT ON dbo.Orders TO AppUser;
-- Verify effective permissions
EXECUTE AS USER = 'AppUser';
SELECT HAS_PERMS_BY_NAME('dbo.Orders', 'OBJECT', 'SELECT') AS can_select;
SELECT HAS_PERMS_BY_NAME('dbo.Orders', 'OBJECT', 'DELETE') AS can_delete; -- should be 0
REVERT;
Backup and Recovery
SQL Server 2025 adds ZSTD compression — faster and smaller than previous compression — and the ability to run full and differential backups on secondary AG replicas to reduce primary workload.
-- Full backup with ZSTD compression (SQL Server 2025)
BACKUP DATABASE [SalesDB]
TO DISK = N'\\backup-share\SalesDB_Full.bak'
WITH COMPRESSION, ALGORITHM = ZSTD, CHECKSUM, STATS = 5;
-- Backup on a secondary AG replica -- offloads I/O from the primary
BACKUP DATABASE [SalesDB]
TO DISK = N'\\backup-share\SalesDB_Full_Secondary.bak'
WITH COMPRESSION, CHECKSUM, COPY_ONLY, STATS = 5;
Pros and Cons of SQL Server 2025
Pros
- Strong backward compatibility — existing workloads run without changes
- Optimized Locking improves concurrency with zero code changes
- Native vector search removes the need for a separate vector database
- Native JSON type and RegEx modernize T-SQL development
- ZSTD compression reduces backup size and duration
- Standard Edition significantly upgraded: 32 cores, 256 GB RAM
- Excellent tooling with SSMS 22 and Azure Data Studio
- Hybrid-ready without forcing migration to Azure
Cons
- Enterprise Edition licensing remains expensive
- AI and vector features require careful governance and testing
- TDS 8.0 default encryption breaks some linked server and replication configs on upgrade
- Preview features require
PREVIEW_FEATURES = ON— not for all production environments - Web Edition discontinued — no low-cost path for hosting providers
- Over-indexing and poor schema design are still common pitfalls — 2025 does not fix bad fundamentals
Hands-On Workshop: Novice to Advanced
Build a small but representative database while working through core SQL Server 2025 fundamentals. Each step introduces concepts that build on the previous one.
Create a Database and Table
CREATE DATABASE WorkshopDB;
GO
USE WorkshopDB;
GO
CREATE TABLE dbo.Orders
(
OrderID INT IDENTITY(1,1) PRIMARY KEY,
CustomerName NVARCHAR(200) NOT NULL,
OrderTotal DECIMAL(10,2) NOT NULL,
OrderDate DATETIME2 NOT NULL DEFAULT SYSDATETIME(),
Notes JSON NULL -- native JSON column
);
This introduces databases, tables, identity columns, defaults, constraints, and the native JSON type — all in one object.
Insert and Query Data
INSERT INTO dbo.Orders (CustomerName, OrderTotal, Notes)
VALUES
('Alice', 120.50, '{"priority":"high", "source":"web"}'),
('Bob', 75.00, '{"priority":"normal","source":"app"}'),
('Charlie', 300.00, '{"priority":"high", "source":"phone"}');
-- Standard query
SELECT * FROM dbo.Orders ORDER BY OrderDate DESC;
-- Query JSON data natively
SELECT
CustomerName, OrderTotal,
JSON_VALUE(Notes, '$.priority') AS priority,
JSON_VALUE(Notes, '$.source') AS source
FROM dbo.Orders
WHERE JSON_VALUE(Notes, '$.priority') = 'high';
Add Indexes and Review Execution Plans
CREATE NONCLUSTERED INDEX IX_Orders_OrderDate
ON dbo.Orders (OrderDate)
INCLUDE (CustomerName, OrderTotal);
-- Run a filtered query and look for Index Seek in the execution plan
SELECT CustomerName, OrderTotal
FROM dbo.Orders
WHERE OrderDate >= DATEADD(DAY, -30, SYSDATETIME());
In the execution plan: Seek means the index was used correctly. Scan means a full table scan — add or adjust an index before considering hardware upgrades.
Enable Optimized Locking and Query Store
-- Enable Optimized Locking (no code changes required)
ALTER DATABASE WorkshopDB SET OPTIMIZED_LOCKING = ON;
-- Enable Query Store in Read-Write mode
ALTER DATABASE WorkshopDB SET QUERY_STORE = ON;
ALTER DATABASE WorkshopDB SET QUERY_STORE
(
OPERATION_MODE = READ_WRITE,
CLEANUP_POLICY = (STALE_QUERY_THRESHOLD_DAYS = 30),
MAX_STORAGE_SIZE_MB = 1024,
QUERY_CAPTURE_MODE = AUTO
);
-- Verify both settings
SELECT name, is_optimized_locking_on, is_query_store_on
FROM sys.databases WHERE name = 'WorkshopDB';
Query Store is your built-in performance time machine. Enable it on every user database from day one — retroactive enablement means you lose history you cannot get back.
Security: Least Privilege Login
CREATE LOGIN AppUser
WITH PASSWORD = 'StrongPassword!123',
CHECK_POLICY = ON,
CHECK_EXPIRATION = ON;
CREATE USER AppUser FOR LOGIN AppUser;
GRANT SELECT, INSERT ON dbo.Orders TO AppUser;
-- Verify effective permissions
EXECUTE AS USER = 'AppUser';
SELECT HAS_PERMS_BY_NAME('dbo.Orders', 'OBJECT', 'SELECT') AS can_select;
SELECT HAS_PERMS_BY_NAME('dbo.Orders', 'OBJECT', 'DELETE') AS can_delete;
REVERT;
Advanced: Top Queries from Query Store
-- Top 10 queries by total CPU consumption
SELECT TOP 10
qsqt.query_sql_text,
SUM(qsrs.avg_cpu_time * qsrs.count_executions) AS total_cpu_us,
SUM(qsrs.count_executions) AS total_executions,
AVG(qsrs.avg_duration) AS avg_duration_us,
MAX(qsp.last_execution_time) AS last_seen
FROM sys.query_store_query qsq
JOIN sys.query_store_query_text qsqt ON qsqt.query_text_id = qsq.query_text_id
JOIN sys.query_store_plan qsp ON qsp.query_id = qsq.query_id
JOIN sys.query_store_runtime_stats qsrs ON qsrs.plan_id = qsp.plan_id
GROUP BY qsqt.query_sql_text
ORDER BY total_cpu_us DESC;
Run this weekly. Fix the worst CPU consumers before scaling hardware. The query that appears at the top of this list is almost always more impactful than adding vCores.
Final Thoughts
SQL Server 2025 does not require you to relearn SQL. But it rewards those who master both the timeless fundamentals and the genuinely new capabilities this version brings. Optimized Locking can improve concurrency in systems that have struggled with blocking for years — with no code changes. Native vector search removes an entire category of external dependency for teams building AI-integrated applications. Native JSON and RegEx bring T-SQL closer to the expressiveness of modern application languages.
If you are new to SQL Server, focus on understanding why things work — why data and log files are separate, why column order in an index matters, why constraints improve execution plans. If you are experienced, SQL Server 2025 gives you genuinely better tools to enforce good practices and prevent mistakes before they become incidents. Strong fundamentals are still the difference between reacting to problems and preventing them.
References
- Microsoft Docs – What’s New in SQL Server 2025
- Microsoft Docs – Vector Data Type in SQL Server 2025
- Microsoft Docs – Optimized Locking
- Microsoft Docs – JSON Data in SQL Server
- Microsoft Docs – Query Store Overview
- Microsoft Docs – Security Best Practices
- Tim Radney – SQL Server 2025: What’s New and Why It Matters
- Microsoft Blog – Announcing SQL Server 2025
Discover more from SQLYARD
Subscribe to get the latest posts sent to your email.


