---
title: "Database optimization and maintenance"
slug: "database-optimization-and-maintenance"
abstract: "Introduction to database optimization and maintenance."
---
# Database optimization and maintenance

This section outlines best practices for maintaining the performance of Sitecore XM databases in On-Premise, Azure IaaS, and Azure PaaS deployments. It covers [index maintenance strategies](https://doc.sitecore.com/xp/en/developers/105/sitecore-experience-manager/sql-index-maintenance-strategy.html "SQL index maintenance strategy"), [statistics maintenance](https://doc.sitecore.com/xp/en/developers/105/sitecore-experience-manager/statistics-updates.html "Statistics updates"), [publishing and queue table cleanup](https://doc.sitecore.com/xp/en/developers/105/sitecore-experience-manager/publishing-and-queue-table-maintenance.html "Publishing and queue table maintenance"), and [role-specific database behaviors](https://doc.sitecore.com/xp/en/developers/105/sitecore-experience-manager/role-specific-considerations.html "Role-specific considerations"). It also contains information on how to [automate index and statistics maintenance](https://doc.sitecore.com/xp/en/developers/105/sitecore-experience-manager/automating-index-and-statistics-maintenance.html "Automating index and statistics maintenance") as well as how to [troubleshoot performance issues](https://doc.sitecore.com/xp/en/developers/105/sitecore-experience-manager/troubleshooting-performance-issues.html "Troubleshooting performance issues").

## XM databases

The key Sitecore XM databases are:

- **Core** – system settings, user accounts, and application state
- **Master** – content authoring and versioning
- **Web** – live site content for delivery

## Resources

The following resources are available to help you optimize and maintain the databases:

- **Ola Hallengren** - [https://ola.hallengren.com](https://ola.hallengren.com/)
- **Microsoft documentation** - [sys.dm_db_index_physical_stats](https://learn.microsoft.com/sql/relational-databases/system-functions/sys-dm-db-index-physical-stats-transact-sql)
- **Sitecore KBs** - `EventQueue` cleanup, History table management