why test.db become bigger and bigger

Nov 21, 2013 at 1:30 AM
   public void StoreOrUpdate(string name)
    {
        var sport = new Sport(name,new DateTime(2001,1,12));
        using (var odb = OdbFactory.Open("test.db"))
        {
            var query = odb.Query<Sport>();
             query.Descend("Name").Constrain(name).Equal();
             List<Sport> spotlst = query.Execute<Sport>().ToList<Sport>();
            // Store the object
             if (spotlst.Count == 0)
            {
                odb.Store<Sport>(sport);
            }
            else
            {
                for (int i = 0; i < spotlst.Count; i++)
                {
                    spotlst[i].Dt = DateTime.Now;
                    odb.Store<Sport>(spotlst[i]);
                }
            }
        }



if i try StoreOrUpdate manytimes
i only want to update the one object,but test.db become bigger and bigger
Nov 23, 2013 at 12:22 PM
I have the same problem with collection that i completely delete and then recreate. It seems that the deleted objects are not really removed from the file. I tried the DefragmentTo but i cannot change the db name and the size remain the same even after i use it. I'm new about NDatabase so maybe i'm missing something.
Coordinator
Dec 7, 2013 at 12:52 PM
You are right, objects are not removed from db, they are only marked as deleted. To clean database, please use DefragmentTo method. If you want to keep the same name, it is best to give it some temporary name, then backup original and make the new one with original name (during that no one should use database file).

Regards,
Jacek
Dec 10, 2013 at 10:14 AM
I tried the DefragmentTo but my db file don't become smaller

i think,maybe my object too big?

if ndatabase has GC to clear the defragment

that's sound a good idear



I would like to say sorry my poor english

and Thanks jacek and promentinif