【发布时间】:2015-12-08 04:42:32
【问题描述】:
我在 oracle 中有一个数字字符串列,有或没有前导零样本:
00000000056
5755
0123938784579343
00000000333
984454
问题是使用like的部分搜索操作非常慢
select account_number from accounts where account_number like %57%
一种解决方案是将搜索限制为仅精确匹配,并添加一个额外的整数列来表示精确匹配的数值。
在这一点上,我不确定我们是否可以添加一个额外的列,
大家还有什么想法吗?
是否可以告诉 Oracle 将数字字符串列索引为整数值,以便我们可以对其进行精确的数字匹配?
例如查询值:00000000333
将是:
select account_number from accounts where account_number = '333'
忽略前导零。
我可以使用regex_like 并忽略它们,但我担心它会很慢。
【问题讨论】:
标签: sql oracle performance indexing oracle11g