---
title: Keep the OpenLM SLM database small
description: Find what takes up space in the OpenLM Version 26 database, clear stuck persisted messages, purge old usage history, and retire workstations you no longer need.
product: OpenLM Version 26 (legacy)
---

> **OpenLM Version 26 (legacy).** This page documents the legacy product, not OpenLM Platform.

When the OpenLM SLM database runs short of space, find which tables are growing before you delete anything. Usage history grows by design, and you trim it with Cleanup Manager. The persisted messages table should stay small: when it grows, OpenLM SLM isn't processing some messages, and you can clear them.

## Find what takes up space

Back up the database before you change anything. Then list the largest tables.

On Microsoft SQL Server:

```sql
SELECT t.name AS table_name, SUM(a.total_pages) * 8 / 1024 AS size_mb
FROM sys.tables t
JOIN sys.indexes i ON t.object_id = i.object_id
JOIN sys.partitions p ON i.object_id = p.object_id AND i.index_id = p.index_id
JOIN sys.allocation_units a ON p.partition_id = a.container_id
GROUP BY t.name
ORDER BY size_mb DESC;
```

On MySQL or MariaDB, replace `<openlm_database>` with the name of your OpenLM SLM database:

```sql
SELECT table_name, ROUND((data_length + index_length) / 1024 / 1024) AS size_mb
FROM information_schema.tables
WHERE table_schema = '<openlm_database>'
ORDER BY size_mb DESC;
```

Two tables matter most:

- `OLM_USED_LICENSES_HS` holds the usage history. It's normally the largest table. To shrink it, purge old history with [Cleanup Manager](https://www.openlm.com/documentation/legacy/openlm-slm/openlm-easyadmin-user-interface-administration/cleanup-manager-module).
- `OLM_PERSISTED_MESSAGE` holds the messages Brokers have sent that OpenLM SLM hasn't processed yet. It should be small or empty. If it's large, see the next section.

## Clear stuck persisted messages

OpenLM SLM processes the Broker messages of each monitored license server and deletes them once they're processed. OpenLM SLM never processes the messages of a license server that you removed, disabled, or renamed, so they stay in `OLM_PERSISTED_MESSAGE` and the table keeps growing.

1. Find which license servers the messages belong to.

   On Microsoft SQL Server:

   ```sql
   SELECT [LM_SERVER], [PORT], MIN([INSERT_TIME_UTC]) AS MIN_TIME, MAX([INSERT_TIME_UTC]) AS MAX_TIME, COUNT(*) AS NR
   FROM [OLM_PERSISTED_MESSAGE]
   GROUP BY [LM_SERVER], [PORT]
   ORDER BY COUNT(*) DESC;
   ```

   On MySQL or MariaDB:

   ```sql
   SELECT LM_SERVER, PORT, MIN(INSERT_TIME_UTC) AS MIN_TIME, MAX(INSERT_TIME_UTC) AS MAX_TIME, COUNT(*) AS NR
   FROM olm_persisted_message
   GROUP BY LM_SERVER, PORT
   ORDER BY COUNT(*) DESC;
   ```

2. For each license server at the top of the list, check it in EasyAdmin:
   - If you no longer monitor it, OpenLM SLM never processes its messages. Go to step 3.
   - If you still monitor it and its messages keep piling up, OpenLM SLM can't process them. Check the server for data errors in EasyAdmin and check its Broker configuration before you delete anything.
3. Delete the messages of the license servers you no longer monitor. Replace `<host>` and `<port>` with the values from step 1:

   ```sql
   DELETE FROM OLM_PERSISTED_MESSAGE WHERE LM_SERVER = '<host>' AND PORT = <port>;
   ```

   If every message belongs to license servers you no longer monitor, you can empty the table instead with `TRUNCATE TABLE OLM_PERSISTED_MESSAGE;`. Don't delete the messages of a server you still monitor: they're usage that OpenLM hasn't recorded yet.
4. Watch the table over the next days to make sure it doesn't grow again.

Newer OpenLM SLM versions keep fewer messages in this table, so [upgrading OpenLM SLM](https://www.openlm.com/documentation/legacy/openlm-slm/index#upgrading-an-existing-openlm-slm-installation) also helps. To get a warning before the table grows again, turn on the **Persistence queue overflow** alert in [OpenLM alerts configuration](https://www.openlm.com/documentation/legacy/openlm-slm-features/openlm-alerts-configuration).

## Retire workstations you no longer need

Cleanup Manager removes history, groups, and users, but not workstations. To remove workstations, for example after someone installed the Workstation Agent on many machines by mistake:

1. In EasyAdmin, go to **Start → Users & Groups → Workstations**.
2. Select the workstations to remove, and then select **Retire**.

You can't retire a workstation whose Workstation Agent still reports to OpenLM SLM. Uninstall the agent from that machine first.

To also remove the users that the Workstation Agent created and that have no usage, run Cleanup Manager on **Users** with the creation source **Agent**. See [Cleanup Manager module](https://www.openlm.com/documentation/legacy/openlm-slm/openlm-easyadmin-user-interface-administration/cleanup-manager-module).
