gpt4 book ai didi

sql - 如何计算查询时间

转载 作者:行者123 更新时间:2023-12-01 04:03:04 25 4
gpt4 key购买 nike

我有这个很长 SQL command很多JOINUNION声明。

我开了 Explain Plan Window ,但我不知道是什么 Cost , Cardinality , 或 Bytes意思。

有人可以解释这些术语吗?而且越低就意味着越快 query时间?

最佳答案

正如我在 oracle Documentation 中看到的那样

CARDINALITY: Estimate by the cost-based approach of the number of rows accessed by the operation.

BYTES: Estimate by the cost-based approach of the number of bytes accessed by the operation.

COST: Cost of the operation as estimated by the optimizer's cost-based approach. For statements that use the rule-based approach, this column is null. Cost is not determined for table access operations. The value of this column does not have any particular unit of measurement; it is merely a weighted value used to compare costs of execution plans. The value of this column is a function of the CPU_COST and IO_COST columns.



所以,你还需要知道:

*CPU_COST:* CPU cost of the operation as estimated by the optimizer's cost-based approach. For statements that use the rule-based approach, this column is null. The value of this column is proportional to the number of machine cycles required for the operation.

*IO_COST:* I/O cost of the operation as estimated by the optimizer's cost-based approach. For statements that use the rule-based approach, this column is null. The value of this column is proportional to the number of data blocks read by the operation.

关于sql - 如何计算查询时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12061151/

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