javaphpnosqlgriddb

Usage of GridDB's set_auto_commit() function


At several points in the documentation of GridDB the auto-commit feature is disabled and instead there are manual commits. I did not manage to find any explanation for this behaviour. It seems that it needs to be disabled when deleting a row from a GridDB container, but not for example when adding a row. In the later case there seems to be little difference between it being active or not. Though of course one has to commit manually at least once if it is disabled for changes to actually be reflected by the database.

So what does auto-commit exactly do, when is it committing changes automatically? When is there a need to or an advantage from disabling auto-commit?

These are the functions I am talking about:

Java: col.setAutoCommit(false); col.commit();

PHP: col->set_auto_commit(false); col->commit();


Solution

  • Auto commit allows GridDB to determine when is best to commit resulting in good performance but also allows other clients to fetch stale data.

    I disable auto commit and commit manually every time for a singular write or any number deletes or updates but leave auto commit on when writing a stream of data.