Need help on a fuzzy match problem

A fuzzy match is request to perform a provider match while loading extract file from clients, the code is easy but we met an efficiency problem.

On the extract file, each the provider has a not null account_no as their identity; also, we have a column pr_account_no ( with index ) in our production. 

The problem is, both of them are varchar2 data type and have both leading '0's, plus, the extract file may have trailing '0's too. so all the following account_no in extract file should be matched  with the provider '00012345' in our system:

'001234500', '12345', '000012345', '1234500000', etc.

The current code is like this:

with 
  providers as (
   select 1 id'0012345' pr_account_no from dual union all
   select 2,      '0023450' from dual
    ),
clients  as  (
   select  '001234500'  client_account_no  from  dual  union all   -- will match to provider 1
  select  '000012345'     from  dual  union all  -- will match to provider 1
  select  '1234500000'   from  dual  union all -- will match to provider 1
  select  '00234500'      from  dual  union all  -- will match to provider 2
  select  '23450'         from  dual  union all   -- will match to provider 2
  select  '000023450'     from  dual  union all  -- will match to provider 2
  select  '00002345'      from  dual  union all  -- will NOT match to provider 2
  select  '12345'         from  dual  union all  -- will match to provider 1
  select  '2345'         from  dual            --  will NOT match to provider 2
)
s ele ct  
   providers.id, providers.pr_account_no , clients.client_account_no
from   providers, clients 
where  regexp_like
     ( clients.client_account_no,
          '0*' ||  trim leading  '0'  from  providers.pr_account_no )|| '0*'
     );

As of the efficiency issue,  we have  574 K rows in provider table, and 74K rows in extract file on a daily basis which is processed row by row. 

About 5-7 minutes only on this matching procedure in  11g 2, which is not acceptable according to the business request. Any one would have some hints to improve it? Appreciated in advance.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值