问题
By default, documentdb creates an index on every path in a JSON. If we insert a JSON with twenty key-value pairs, documentdb will create indexes on all of these values. Whereas in SQL server, having twenty indexes on a general table is not desirable (especially on transaction tables).
- So why documentdb does this?
- Is it because it works on most of the scenarios in documentdb? If So, why?
回答1:
Because DocumentDB is designed for schema and query flexibility. DocumentDB is a NoSQL database that is designed to be write optimized, and uses a combination of log structured storage techniques + IR/inverted index techniques to index all properties with a low compute and storage overhead. You can learn more about how this is possible here: http://www.vldb.org/pvldb/vol8/p1668-shukla.pdf
来源:https://stackoverflow.com/questions/42737508/why-azure-documentdb-creates-index-on-each-path-by-default