gpt4 book ai didi

mysql - 数据库索引困惑

转载 作者:行者123 更新时间:2023-11-29 22:27:30 25 4
gpt4 key购买 nike

我现在一直在试图找出几个答案的答案,但似乎无法理解它。谁能告诉我这些答案是如何计算的?我知道:A = 1000,B = 20,C = 10,D = 10和E = 1。我明白,当没有索引时,我们必须搜索50 X 20,因为我们需要遍历所有的sensorID( 50)和所有时间(每次 20)。然后当我们在sensorID上建立索引时,我们只需要通过时间来搜索即可。当我们按时设置索引并将其降至 10 时,我主要会迷失方向。难道不应该是 50 吗?

enter image description here

最佳答案

I mainly get lost when we put an index on time and it drops it down to 10. Shouldn't it be 50?

仔细阅读问题:

... there are exactly 10 readings for every unique time...

这意味着在 1 次索引查找操作(您不需要像问题中所述那样考虑)之后,数据库引擎只需遍历 10 行(元组),对 sensorID 应用过滤器 查找目标记录。

关于mysql - 数据库索引困惑,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30146614/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com