GBase 8a
运维管理
文章

Gbase8a MPP 查询条件优化(1)

发表于2025-12-23 14:25:5811次浏览0个评论

查询条件不要使用函数

建议where条件中的列尽量不使用函数运算,因为加函数运算会造成智能索引失效,sql 性能降低。

例如:原始sql为:where substr(product_no, 2, 1) in ('3', '4', '5', '8')

            智能索引失效,性能非常低。

            改写为:where (product_no like '13%' or product_no like '14%' or product_no like '15%' orproduct_no like '18%')'

            智能索引将对字符串类型数据前8个字符的索引。

评论

登录后才可以发表评论