Database size not stabilizing

Symptom

Your application collects a lot of large binary objects among multiple client devices, synchronizes this information to a consolidated database, and then the synchronized data is deleted from each client device. However, the database size remains large despite the data being removed from the database. This is a concern because file size needs to be managed carefully due to limited resources of the device.

Explanation

Database size should only increase if your data grows in the database. However, once grown, the database file keeps that size, and does not shrink on its own. Free space is maintained internally to the file.

Recommendation

Ensure you are not using the STOP SYNCHRONIZATION DELETE or TRUNCATE statements for tables that do not get synchronized. Instead use the DELETE statement with a FROM table-name clause for tables that do not get synchronized.

Recreate the database post-synchronization:

  1. Create your UltraLite database that is deployed to the devices.

  2. Creating a SQL script of DDL statements that define the schema required by the client devices. See Deploying UltraLite schema upgrades.

  3. Synchronize the data.

  4. Drop the database.

  5. Create a new, empty database and use standard database schema with the ALTER DATABASE SCHEMA FROM FILE statement.

See also