我知道 Mysql 用 count 的时候如果数据量大会很慢.
如果我在 mongodb 里用 .length 性能会怎么样呢?
PHP中文网2017-04-25 09:06:24
In mongodb, query performance still depends on whether the entire document needs to be traversed and whether to create an index.
PHP中文网2017-04-25 09:06:24
It will be just as slow as the amount of data is large. For example: it took 0.001s to count 1,000 items, and 0.1s to count 1,000,000 items. It's faster if you have an index. As the amount of data increases, all kinds of problems arise.