Database Reference
In-Depth Information
key-value pairs that it must scan sequentially to find the minute slot we're actually updating.
So for the final minute of the day, MongoDB needs to examine 1,439 slots before actually
finding the correct one to update. The solution to this is to build hierarchy into the minute
property.
Figure 4-3. Performance with pre-allocated documents
One document per page per day, hierarchical documents
To optimize update and insert operations, we'll introduce some intra-document hierarchy. In
particular, we'll split the minute field into 24 hourly fields:
{
_id : "20101010/site-1/apache_pb.gif" ,
metadata : {
date : ISODate ( "2000-10-10T00:00:00Z" ),
site : "site-1" ,
page : "/apache_pb.gif" },
daily : 5468426 ,
hourly : {
Search WWH ::




Custom Search