swift - CoreData:相同查询的不同执行时间
问题描述
我正在使用 CoreData 在具有 35 个属性(所有字符串)的表中存储大约 250.000 行数据,此时它们都没有被索引。当我在没有其他应用程序运行的情况下启动应用程序并执行以下查询时,多次启动的获取执行时间不同。
1)CoreData: sql: SELECT t0.ZBP_Q, COUNT( t0.ZNOF_LAY) FROM ZVEH t0 GROUP BY t0.ZBP_Q
CoreData: annotation: sql connection fetch time: 0.4265s
CoreData: annotation: total fetch execution time: 0.4266s for 15 rows.
2)CoreData: sql: SELECT t0.ZBP_Q, COUNT( t0.ZNOF_LAY) FROM ZVEH t0 GROUP BY t0.ZBP_Q
CoreData: annotation: sql connection fetch time: 9.9614s
CoreData: annotation: total fetch execution time: 9.9615s for 15 rows.
首先,0.4266s 对于 15 行来说似乎很长,不是吗?但是,为什么应用程序在完全相同的条件下执行完全相同的查询需要大约 10 秒才能再次启动?以及如何确保每次启动的 0.4266 秒? 似乎应用程序随机需要很长时间或非常快(我对 0.4266 秒很好)。
解决方案
推荐阅读
- r - 如何使用 inst/extdata 中的文件?R 包检查防止在 R 3.6 中使用 system.file()
- javascript - 获取后“TypeError:无法读取未定义的属性'forEach'”
- python - 当我知道密钥存在时如何处理 Python (JSON) 密钥错误?
- asp.net-mvc - 未找到 MSBuild 发布配置文件 .pubxml.user 文件
- javascript - Javascript - Puppeteer - 文本查找
- vaticle-typedb - 有没有办法在 .gql 文件中编写插入 GRAQL 语句并在 GRAKN 控制台或 Workbase 中处理它?
- itext - itextsharp 如何识别我有缩写框
- azure-cognitive-search - Azure 搜索 - 当可搜索值具有句子分隔符时,搜索突出显示值会中断
- javascript - 节点 Keycloak 请求即使使用不记名令牌也会返回登录
- spring - Spring使用自定义请求配置WebClient Oauth2身份验证