# olahallengren/sql-server-maintenance-solution architecture

> Architecture diagram of the GitHub repository olahallengren/sql-server-maintenance-solution, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/olahallengren/sql-server-maintenance-solution
- Repository: https://github.com/olahallengren/sql-server-maintenance-solution

## Overview

This repository is a SQL Server maintenance solution delivered as installable SQL scripts and separate stored-procedure scripts. Its documented maintenance stages are database backup, integrity checking, and index/statistics maintenance; each uses CommandExecute to run and log commands. CommandLog is an optional logging table, while Queue and QueueDatabase support parallel database processing. The README describes the installers’ scope and component dependencies; source excerpts were unavailable, so relationships beyond those documented are omitted.

Main entry points: [`MaintenanceSolution.sql`](https://github.com/olahallengren/sql-server-maintenance-solution/blob/main/MaintenanceSolution.sql) (Full installer), [`CommandExecute.sql`](https://github.com/olahallengren/sql-server-maintenance-solution/blob/main/CommandExecute.sql) (Command execution), [`DatabaseIntegrityCheck.sql`](https://github.com/olahallengren/sql-server-maintenance-solution/blob/main/DatabaseIntegrityCheck.sql) (Integrity check), [`IndexOptimize.sql`](https://github.com/olahallengren/sql-server-maintenance-solution/blob/main/IndexOptimize.sql) (Index maintenance)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_install["Installation"]
  node_full_installer["Full installer"]
  node_azure_installer["Azure DB installer"]
end

subgraph group_maintenance["Maintenance"]
  node_backup["Database backup<br/>[DatabaseBackup.sql]"]
  node_integrity["Integrity check"]
  node_index_maintenance["Index maintenance<br/>[IndexOptimize.sql]"]
end

subgraph group_execution["Execution and logging"]
  node_command_execute["Command execution<br/>[CommandExecute.sql]"]
  node_command_log[("Command log<br/>[CommandLog.sql]")]
end

subgraph group_parallel["Parallel processing"]
  node_queue[("Processing queue<br/>[Queue.sql]")]
  node_queue_database[("Database queue<br/>[QueueDatabase.sql]")]
end

node_sqlserver_admin(("SQL Server operator"))

node_full_installer -->|"installs"| node_backup
node_full_installer -->|"installs"| node_integrity
node_full_installer -->|"installs"| node_index_maintenance
node_full_installer -->|"installs"| node_command_execute
node_full_installer -->|"installs"| node_command_log
node_full_installer -->|"installs"| node_queue
node_full_installer -->|"installs"| node_queue_database
node_azure_installer -->|"installs"| node_integrity
node_azure_installer -->|"installs"| node_index_maintenance
node_backup -->|"uses"| node_command_execute
node_integrity -->|"uses"| node_command_execute
node_index_maintenance -->|"uses"| node_command_execute

click node_full_installer "https://github.com/olahallengren/sql-server-maintenance-solution/blob/main/MaintenanceSolution.sql"
click node_azure_installer "https://github.com/olahallengren/sql-server-maintenance-solution/blob/main/MaintenanceSolutionAzureSQLDatabase.sql"
click node_backup "https://github.com/olahallengren/sql-server-maintenance-solution/blob/main/DatabaseBackup.sql"
click node_integrity "https://github.com/olahallengren/sql-server-maintenance-solution/blob/main/DatabaseIntegrityCheck.sql"
click node_index_maintenance "https://github.com/olahallengren/sql-server-maintenance-solution/blob/main/IndexOptimize.sql"
click node_command_execute "https://github.com/olahallengren/sql-server-maintenance-solution/blob/main/CommandExecute.sql"
click node_command_log "https://github.com/olahallengren/sql-server-maintenance-solution/blob/main/CommandLog.sql"
click node_queue "https://github.com/olahallengren/sql-server-maintenance-solution/blob/main/Queue.sql"
click node_queue_database "https://github.com/olahallengren/sql-server-maintenance-solution/blob/main/QueueDatabase.sql"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_full_installer,node_azure_installer toneBlue
class node_backup,node_integrity,node_index_maintenance toneAmber
class node_command_execute,node_command_log,node_sqlserver_admin toneMint
class node_queue,node_queue_database toneRose
```

## Components

### Installation

- [Full installer](https://github.com/olahallengren/sql-server-maintenance-solution/blob/main/MaintenanceSolution.sql): `MaintenanceSolution.sql`
- [Azure DB installer](https://github.com/olahallengren/sql-server-maintenance-solution/blob/main/MaintenanceSolutionAzureSQLDatabase.sql): `MaintenanceSolutionAzureSQLDatabase.sql`

### Maintenance

- [Database backup](https://github.com/olahallengren/sql-server-maintenance-solution/blob/main/DatabaseBackup.sql): `DatabaseBackup.sql`
- [Integrity check](https://github.com/olahallengren/sql-server-maintenance-solution/blob/main/DatabaseIntegrityCheck.sql): `DatabaseIntegrityCheck.sql`
- [Index maintenance](https://github.com/olahallengren/sql-server-maintenance-solution/blob/main/IndexOptimize.sql): `IndexOptimize.sql`

### Execution and logging

- [Command execution](https://github.com/olahallengren/sql-server-maintenance-solution/blob/main/CommandExecute.sql): `CommandExecute.sql`
- [Command log](https://github.com/olahallengren/sql-server-maintenance-solution/blob/main/CommandLog.sql): `CommandLog.sql`

### Parallel processing

- [Processing queue](https://github.com/olahallengren/sql-server-maintenance-solution/blob/main/Queue.sql): `Queue.sql`
- [Database queue](https://github.com/olahallengren/sql-server-maintenance-solution/blob/main/QueueDatabase.sql): `QueueDatabase.sql`

### Other components

- **SQL Server operator**

## Connections

- Full installer → Database backup: installs (evidence: `README.md`)
- Full installer → Integrity check: installs (evidence: `README.md`)
- Full installer → Index maintenance: installs (evidence: `README.md`)
- Full installer → Command execution: installs (evidence: `README.md`)
- Full installer → Command log: installs (evidence: `README.md`)
- Full installer → Processing queue: installs (evidence: `README.md`)
- Full installer → Database queue: installs (evidence: `README.md`)
- Azure DB installer → Integrity check: installs (evidence: `README.md`)
- Azure DB installer → Index maintenance: installs (evidence: `README.md`)
- Database backup → Command execution: uses (evidence: `README.md`)
- Integrity check → Command execution: uses (evidence: `README.md`)
- Index maintenance → Command execution: uses (evidence: `README.md`)
