As you update and delete data from a VistaDB database you notice the file continues to grow.
To enable transaction support VistaDB makes a copy of rows that are deleted or updated so various transactions can be tracked and rolled back if necessary. Additionally, when a row is deleted its space is freed in the database page it is stored on but that space can rarely be taken advantage of unless another row on the same page expands. When new rows are added they're always added to the end of the physical table storage. These techniques are fairly common in embedded databases like VistaDB and tend to cause the file to grow in size as rows are inserted and, in some cases, updated. Using explicit transactions significantly increases this effect.
To release the space the database needs to be packed. This process requires exclusive access to the database file so it can rewrite all of the rows, skipping deleted and obsolete rows. It will also rebuild all indexes which can improve performance in the case where there have been a large number of deletions and additions.
Here is a simple example of packing a database:
IVistaDBDDA DDAObj = VistaDB.DDA.VistaDBEngine.Connections.OpenDDA(); // Use a specific path on the drive DDAObj.PackDatabase(@"c:\test.vdb5"); // Use the local working directory path where the EXE was launched DDAObj.PackDatabase(@"test.vdb5");
For more information see How To - Pack a Database (VistaDB Documentation) as well as IVistaDBDDA.PackDatabase (VistaDB API Documentation)