Optimization of Mongodb index?
伊谢尔伦
伊谢尔伦 2017-05-17 10:01:49
0
2
687

I don’t know if there is no optimization in the index village. There is no in-depth understanding of indexes. Please help explain it by the way!

1. Each piece of data has geographical information. (province, city), then I created an index:

db.v.createIndex({city:1}
db.v.createIndex({area:1}

My doubt is, when this is created, is there no piece of data to create an index value or is it created based on the index value?

    比如存在这样的数据
    id name         city         area 
    1  zhangsan     beijing      beijing
    2  lisi         shanghai     shanghai
    3  zhaowu       beijing      beijing

   #每条数据建立 
    city->beijing->1
    city->shanghai -> 2
    city->beijing->3
    
    #还是根据索引值
    city->beijing--|-> 1
                   |-> 3
    city->shanghai->2
    
    

Thanks

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(2)
为情所困

I don’t fully understand your question. My general understanding is:

1. Most of MongoDB’s indexes are B Tree indexes; in addition,

1)hash index,主要用于hashed sharding
2)Geospatial index,例如2d、2dsphere,在MongoDB里面本质上B Tree实现的
3)Text index

2. B Tree is sorted and saved according to the index value, and points to the storage location of the corresponding Collection.

3. To extend a bit, the current underlying WiredTiger of MongoDB uses a Log-Merged Structure Tree to optimize writing performance.

You can learn more about MongoDB’s indexes above. for reference.

Love MongoDB! Have fun!

滿天的星座

I don’t quite understand your question, but here are some suggestions on using MongoDB to create indexes. You can refer to:
http://forum.foxera.com/mongo...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template