1 Reply Latest reply: Feb 12, 2013 5:41 PM by Dwayne Chung RSS

    Database increase grows its size (with inserts and deletes)

    user13358531
      I think this problem was already answered on this forum, but because of the generic terms of my search I didn't manage to find the answer.

      My problem is this: How to prevent the database to increase its size in case of many deletes of an object.
      My database is Replicated and so, transactional
      I have an very simple Entity like this;
      @Entity
      public class EnExample {
           @PrimaryKey
           private int id;
           
           public EnExample() {
           }
           
           public EnExample(int id) {
                this.id = id;
           }
           
           public int getId() {
                return id;
           }
           
           public void setId(int id) {
                this.id = id;
           }
      }
      I for example purposes I save and delete the same record:
      // PK and all the db stuff and instantiations
      // OBS: the database is Replicated and so, transactional
      private PrimaryIndex<Integer, EnExample> pkExampleById;
      
      // handling insertions and deletes
      
      for (int i = 0; i < 50000; i++) {
           final EnExample enExample = new EnExample(2);
           pkExampleById.put(enExample);
           pkExampleById.delete(enExample.getId());
      }
      when I do this, after closing/shutting down the store and the database, the size of the database increases and never decreases, even if there isn't any elements on the pkExampleById;

      This is because of log of operations isn't it?

      I tried to put some parameters to the environment, specially the log ones: http://docs.oracle.com/cd/E17277_02/html/java/com/sleepycat/je/EnvironmentConfig.html
      with envConfig.setConfigParam(....

      But the size of the database (or log) didn't decreased it surpassed 300 MB.

      Is there a minimum limit of log for it to begin to override the old log files?

      How does it work.

      First, is this a log issue? If not what could I do to prevent the database to increase its size because (in this example, and in many cases I manage the inserts and deletes) I have zero or almost zero count data.