indexing - How MongoDB manage secondary indexes scans? -
by default mongodb creates index on _id key in document. when ensure additional index (secondary in innodb mysql?) , query after, engine scans , selective scan _id index documments offsets?
i'm confused because when sharding comes i'm right every chunk have own indexes , there many random reads per query?
every shard have own index (containing documents in shard), accessed in parallel (every shard reads own local index shard) , results merged. not random reads, multiple parallel index reads. perspective of single shard, looks normal index access.
this index sharding reason why secondary indexes cannot unique in sharding environment (there no single global index ensure uniqueness).
Comments
Post a Comment