oracle中decode函数如何提升查询语句性能的?

2024-11-08 11:06:04
推荐回答(2个)
回答(1):

decode可以代替case when语句,在语句写法上可以节省很多coding的时间
但是执行效率上其实与case when是差不多的
oracle特有这个函数的更多是为了方便使用,而不是效率考虑

回答(2):

Oracle now supports simple and searched CASE statements. CASE statements are similar in purpose to the DECODE statement, but they offer more flexibility and logical power. They are also easier to read than traditional DECODE statements, and offer better performance as well. They are commonly used when breaking categories into buckets like age (for example, 20-29, 30-39, and so on).

并没有证据证明decode更快吧,查资料时倒是看到这么一句话case 方式“offer better performance as well”

额 刚发现你只是问decode··· 这个文档的内容是说decode 和 case when的比较···