Archived
This forum has been archived. Please start a new discussion on GitHub.
Freeze map ordering
in Help Center
This is probably more of a Berkely DB question than a Freeze/Ice question, but I'll try anyway..
If I have a Freeze map that is populated initially and then NOT subsequently modified, can I assume an iterator will supply the entries in the order in which they were inserted?
Based on my limited knowledge of Berkely DB, I'd assume in general this won't be true, but *in practice* so far this has been true when the map is created/written in a single session.
My problem is that I'm creating potentially huge data sets that I need to filter/average, and if I can't assume this type of ordering I'll have to resort to other methods to sort prior to filtering which I'd rather avoid.
If I have a Freeze map that is populated initially and then NOT subsequently modified, can I assume an iterator will supply the entries in the order in which they were inserted?
Based on my limited knowledge of Berkely DB, I'd assume in general this won't be true, but *in practice* so far this has been true when the map is created/written in a single session.
My problem is that I'm creating potentially huge data sets that I need to filter/average, and if I can't assume this type of ordering I'll have to resort to other methods to sort prior to filtering which I'd rather avoid.
0
Comments
-
Freeze maps are stored in Berkeley DB databases in B-Tree format. These databases are sorted, using the default sorting (binary comparison of the keys). See http://www.sleepycat.com/docs/api_cxx/db_set_bt_compare.html.
When you iterate over a Map, you will follow this order.
Cheers,
Bernard0