.net - Best data structure to store an object indexed by a 3-tuple for fast retrieval along each dimension and low memory profile? -


i want store objects indexed 3-tuple of (string, string , datetime). lets call these identifier,category,day

any object in data structure guaranteed unique 3-tuple (no duplicates)

the data structure should support fast answers questions such as:
- unique identifiers?
- categories identiifer "xyz"?
- days identifier = "xyz" , category "mycategory"?

removal possible. great maintain low memory profile.

as baseline, i'm using dictionary<string , dictionary<string , dictionary<datetime , object>>>

theoretically should give me o(1) retrieval, i'm not familiar internals of dictionary , have feeling solution sub-optimal.

i know there's no 1 right answer here , provide numerous usage details, perhaps can give me few ideas play with?

edit
retrieval performed equality (i.e. identiifer = "xyz"). don't use inequalities (greater-than, less-than, etc.)

it depends on relative numbers of values in each column, distribution, , distribution of queries, there's no best answer.

your dictionaries fine retrieval along 1 dimension, have linearly search if want combination of features.

if space weren't problem, have 3 level index (either trees or hash tables) first retrieve items along 1 dimension, use dictionary @ node find items along second dimension value dimension 1, use dictionary @ node find items 3 values.

it matters if want answer queries using inequalities. in case, tree better dictionary because ordered.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -