I am trying here to get a insight on how the B tree is created.
Lets say i am using a number as a index variable. How will the tree be created with depth =1 or Would it be like this - http://knol.google.com/k/-/-/pz98o7ulrif9/zvd1ua/difftree01.png
If so what would be the depth of the tree and what would be the maximum number of children. For compound keys (say 2 index variables), will there be two trees. Or would it be a single tree with first level as first key and second level as second key ? Say i take timestamp as the index key. Can i make it as a tree with first layer as years , second as month , and third as day . Can mongoDB automatically parse this information out?
How will the tree be created with depth =1 or Would it be like this - http://knol.google.com/k/-/-/pz98o7ulrif9/zvd1ua/difftree01.png
Your picture shows a "binary tree" not a "b-tree", these are different.
"B-tree" works by creating buckets of a given size (believe MongoDB uses 4k) and ordering items within those buckets.
If so what would be the depth of the tree and what would be the maximum number of children
Please take a look at the Wikipedia entry on B-trees, it should provide a definitive answer for you.
For compound keys (say 2 index variables), will there be two trees.
Only one tree. However the key stored in the tree is basically the BSON representation of both items "mushed" together.
Say i take timestamp as the index key. Can i make it as a tree with first layer as years , second as month , and third as day . Can mongoDB automatically parse this information out?
No, you have no control over the indexing structure.
No MongoDB does not support any special parsing on dates in indexes.
If you do a comparison operation for timestamps, you will need to send in another timestamp.