In my opinion the storage of relationships can (for many data models) take
much more space than would occur in an RDBMS. The reason for this is that
the relationships contain more information (bi-directional linked lists)
allowing fast traversal of the graph in either direction. This is not true
of the typical foreign key in an RDBMS which is usually taking less space.
For example, an RDBMS with two tables, where one has a foreign key to the
primary key of the other, will store only that reference in the first table
(perhaps 8 bytes) compared to the 33 bytes of the Neo4j relationship. The
second table will have an index on it's primary key, taking some more
space, but still not getting the total anywhere near the 33 bytes of Neo4j.

But this extra space is certainly not wasted. The performance of deep
traversals is dependent on this structure. RDBMS cannot compare. So if you
care about either deep traversals (even slightly deep), or care about
bi-directional traversals, you should not mind the extra space.

Of course, as others have pointed out in other discussions, there are
models that take more space in RDBMS too. But this simple case I used here
is one where Neo4j clearly takes a lot more space.


On Tue, May 27, 2014 at 4:30 AM, Rio Eduardo <rioeduard...@gmail.com> wrote:

> Thank you for the explaination Chris.
>
> On Monday, May 26, 2014 10:31:03 PM UTC+7, Chris Vest wrote:
>
>>
>> On 26 May 2014, at 16:39, Rio Eduardo <rioedu...@gmail.com> wrote:
>>
>> 1. For Memory => Is it because Neo4j stores data in RAM? or are there
>> other causes?
>>
>>
>> It caches both on the entity level, and also has a page cache for memory
>> mapped bits of the store files. Transaction states are currently also
>> entirely in ram. Neo4j is also implemented in Java, which needs extra room
>> for the GC to work. This last part about the GC and managed memory is why
>> it would use more memory than an equivalent C implementation.
>>
>> Databases are in general very fond of memory, because they want to do as
>> little IO as they can get away with.
>>
>> 2. For Disk => Is it because Neo4j store all of relationships? or are
>> there other causes?
>>
>>
>> The storage format is fairly compact for what is stored, actually. It is
>> sort of similar to how MyISAM tables are more compact than InnoDB tables.
>> We still need to store the type and direction for relationships, pointers
>> for both end-nodes and pointers for properties.
>>
>> --
>> Chris Vest
>> System Engineer, Neo Technology
>> [ skype: mr.chrisvest, twitter: chvest ]
>>
>>
>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to neo4j+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

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

Reply via email to