Created
December 2, 2009 00:36
-
-
Save marcellodesales/246793 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> db.SondeDataContainer.stats() | |
{ | |
"ns" : "netbeams.SondeDataContainer", | |
"count" : 2419200, | |
"size" : 1170892976, | |
"storageSize" : 1358632416, | |
"nindexes" : 20, | |
"ok" : 1 | |
} | |
All documents have the following structure | |
> db.SondeDataContainer.findOne() | |
{ | |
"_id" : ObjectId("046f4007e705124bbedf9200"), | |
"message_id" : "49867084-9f47-4412-bff0-a5c517bc6c7a", | |
"sensor" : { | |
"ip_address" : "192.168.0.123", | |
"location" : { | |
"latitude" : 37.89155, | |
"longitude" : -122.4464 | |
} | |
}, | |
"time" : { | |
"valid" : "Sun Nov 22 2009 21:45:06 GMT-0800 (PST)", | |
"transaction" : "Sat Nov 28 2009 21:25:58 GMT-0800 (PST)" | |
}, | |
"observation" : { | |
"WaterTemperature" : 46.47, | |
"SpecificConductivity" : 44.7, | |
"Conductivity" : 110.1, | |
"Resistivity" : 5362.29, | |
"Salinity" : 0.01, | |
"Pressure" : 0.62, | |
"Depth" : 2.075, | |
"pH" : 7.64, | |
"pHmV" : -50.7, | |
"Turbidity" : 0.3, | |
"ODOSaturation" : 105.9, | |
"ODO" : 32.16, | |
"Battery" : 4.4 | |
} | |
} | |
The Indexes were created for all the keys... Here's the performance problem to | |
search 2 different keys with different values... The search for the ip address | |
is fast... (there are only 256 different ip address 192.168.0.x, 1<x<256), The | |
problem is when I search over the observations keys, which have all random | |
values... | |
> db.SondeDataContainer.find( {"sensor.ip_address":"192.168.0.102"} ).explain() | |
{ | |
"cursor" : "BtreeCursor sensor.ip_address_", | |
"startKey" : { | |
"sensor.ip_address" : "192.168.0.102" | |
}, | |
"endKey" : { | |
"sensor.ip_address" : "192.168.0.102" | |
}, | |
"nscanned" : 9505, | |
"n" : 9505, | |
"millis" : 111, | |
"oldPlan" : { | |
"cursor" : "BtreeCursor sensor.ip_address_", | |
"startKey" : { | |
"sensor.ip_address" : "192.168.0.102" | |
}, | |
"endKey" : { | |
"sensor.ip_address" : "192.168.0.102" | |
} | |
}, | |
"allPlans" : [ | |
{ | |
"cursor" : "BtreeCursor sensor.ip_address_", | |
"startKey" : { | |
"sensor.ip_address" : "192.168.0.102" | |
}, | |
"endKey" : { | |
"sensor.ip_address" : "192.168.0.102" | |
} | |
} | |
] | |
} | |
> db.SondeDataContainer.find( {"observation.pH":4.52, "observation.Battery":1.4} ).explain() | |
{ | |
"cursor" : "BasicCursor", | |
"startKey" : { | |
}, | |
"endKey" : { | |
}, | |
"nscanned" : 2419200, | |
"n" : 28, | |
"millis" : 53116, | |
"oldPlan" : { | |
"cursor" : "BasicCursor", | |
"startKey" : { | |
}, | |
"endKey" : { | |
} | |
}, | |
"allPlans" : [ | |
{ | |
"cursor" : "BasicCursor", | |
"startKey" : { | |
}, | |
"endKey" : { | |
} | |
} | |
] | |
} | |
What's the problem? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment