Database file sizes

69 views
Skip to first unread message

Krzysztof Baranowski

unread,
Apr 30, 2011, 9:44:50 PM4/30/11
to OrientDB
Hey Luca,

Noticed something strange today: when using Orient through Blueprints
the size of the database files is dramatically different depending on
whether operations are executed inside a transaction or not. This
simple code...

OrientGraph graph = new OrientGraph("local:data/store/bogus",
"admin", "admin");
// graph.setTransactionMode(Mode.MANUAL);
// graph.startTransaction();
for (int i = 0; i < 30; i++)
{
Vertex v = graph.addVertex(null);
for (int j = 0; j < 100; j++)
{
Vertex c = graph.addVertex(null);
graph.addEdge(null, v, c, "whatever");
}
System.out.println(i);
}
// graph.stopTransaction(Conclusion.SUCCESS);
graph.shutdown();


...yields 140mb of files when run as is (no transactions) and just
20mb when when run with transactions (lines commented back in). Is
this expected behavior? Is there a way to reduce file sizes after the
fact ("defragmenting"?).

Thanks,
Chris

Luca Garulli

unread,
May 2, 2011, 7:42:28 AM5/2/11
to orient-database
Hi Chris,
I suppose you're using latest snapshot, don't you?

However when you begin a new transaction OrientDB operates all the changes 100% in memory until a commit() is called. This could be the reason of such difference in sizes. If you have a lot of updates, in your case every single Vertex is updated when a new edge is created, this creates holes = free space in file. You can minimize the holes by incrementing the oversize http://code.google.com/p/orient/wiki/PerformanceTuning#Oversize.

Lvc@

Krzysztof Baranowski

unread,
May 2, 2011, 6:15:03 PM5/2/11
to OrientDB
Not latest snapshot exactly; I built it myself from svn about a week
ago.

It's not any of the hole files (och) that get big though, actually
it's just default.0.oda

In theory the database size doesn't really matter to me much, but it'd
be nice if there's a way to deal with it if it gets really big and I
don't notice until later on. So is there a way to reduce the size of
an existing database? Perhaps even exporting/re-importing the database
would consolidate things?



On May 2, 7:42 am, Luca Garulli <l.garu...@gmail.com> wrote:
> Hi Chris,
> I suppose you're using latest snapshot, don't you?
>
> However when you begin a new transaction OrientDB operates all the changes
> 100% in memory until a commit() is called. This could be the reason of such
> difference in sizes. If you have a lot of updates, in your case every single
> Vertex is updated when a new edge is created, this creates holes = free
> space in file. You can minimize the holes by incrementing the oversizehttp://code.google.com/p/orient/wiki/PerformanceTuning#Oversize.
>
> Lvc@

Luca Garulli

unread,
May 2, 2011, 6:19:09 PM5/2/11
to orient-database
Yes,
exporting and reimporting the database removes all the holes. However I'm working to the new "compact database" command to shrink it with the database up and running.

Lvc@

Ivan Šturlić

unread,
Aug 3, 2015, 4:35:49 PM8/3/15
to OrientDB
Hi,

Luca, I just needed to compact database after deleting large number of records. Is "compact database" command still in plans?
I know that it is possible to export/import database but it would be more practical to have such command.

Regards, Ivan.

Luca Garulli

unread,
Aug 4, 2015, 8:17:55 PM8/4/15
to OrientDB
Hi Ivan,
We never implemented a "compact database" command, sorry. The only way now is export+import.

Best Regards,

Luca Garulli
Founder & CEO


--

---
You received this message because you are subscribed to the Google Groups "OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages