Skip to content

Commit

Permalink
Use PRAGMA optimize when MDB is closed.
Browse files Browse the repository at this point in the history
  • Loading branch information
rasteric committed Sep 14, 2019
1 parent 52fe4dc commit faa62f4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions minidb.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ func (db *MDB) Backup(destination string) error {
// Close closes the database, making sure that all remaining transactions are finished.
func (db *MDB) Close() error {
if db.base != nil {
_, _ = db.base.Exec(`PRAGMA optimize;`)
err := db.base.Close()
if err != nil {
return Fail("ERROR Failed to close database - %s.\n", err)
Expand Down

0 comments on commit faa62f4

Please sign in to comment.