Home > database >  Oracle added a regexp_replace query is slow
Oracle added a regexp_replace query is slow

Time:10-03

The select f *
The from (
Select
Regexp_replace (regexp_replace (a.k freason, '[(] [^ ()] * []'), '[(] [^ ()] * []') kfreason, a.u sername, b.u seralias,
P. ost
The from examdetail a
Left the join projectusers b on b.u sername=a.u sername and b.e iid='4 de7f10f7b534aa8b77d836e42942fa8'
Where
A.e wid (in
Select aa. Ewid from examworkbreed aa where aa. The typeid='10916'
And aa. Eiid='4 de7f10f7b534aa8b77d836e42942fa8 and aa. The ebid & lt;> '0' and aa. Examajor='AFE237EB77F14468B26D7D5CB0097DE9'
)
F)
Where instr (f.k freason, 'answered not attendant equipment wearing a helmet into an area check') & gt; 0;

Kfreason this field after I use regexp_replace remove the parentheses, use a select nesting. But it is slow;

But if not select nested directly, so directly, speed quickly
Select
Regexp_replace (regexp_replace (a.k freason, '[(] [^ ()] * []'), '[(] [^ ()] * []') kfreason, a.u sername, b.u seralias,
P. ost
The from examdetail a
Left the join projectusers b on b.u sername=a.u sername and b.e iid='4 de7f10f7b534aa8b77d836e42942fa8'
Where
A.e wid (in
Select aa. Ewid from examworkbreed aa where aa. The typeid='10916'
And aa. Eiid='4 de7f10f7b534aa8b77d836e42942fa8 and aa. The ebid & lt;> '0' and aa. Examajor='AFE237EB77F14468B26D7D5CB0097DE9'
) and instr (a.k freason, 'did not answer the attendant equipment wearing a helmet into an area check') & gt; 0;

What reason is this?

CodePudding user response:

Look at the execution plan, two queries, respectively is how walk

CodePudding user response:

Execution plan is not how you look at it, this is the first SQL statement execution plan

This is the second
The same feeling

CodePudding user response:

Feel your this business related, and the key is in parentheses have any effect on the business, or is it possible for all say in parentheses

No, there's no point in the regular basic.

If must use two regular can merge into one

CodePudding user response:

Where instr (f.k freason, 'answered not attendant equipment wearing a helmet into an area check') & gt; 0;
This condition, can filter out a large number of data layers? So, to replace the data will be a lot less, high efficiency naturally

CodePudding user response:

reference 4 floor cjp20160817 response:
where instr (f.k freason, 'answered no attendant equipment wearing a helmet into an area check') & gt; 0;
This condition, can filter out a large number of data layers? So, to replace the data will be a lot less, high efficiency naturally

This means
 where f.k freason like '% did not answer the attendant wearing a helmet into an equipment check area %'; 

Efficiency is not as good as the LIKE

CodePudding user response:

The regular expression, that is, you () () to replace the standard; Main is you have the wrong statement
Line 7 left join projectusers b on b.u sername=a.u sername and b.e iid='4 de7f10f7b534aa8b77d836e42942fa8'

Modified into SQL in this way, some high efficient
 
The select f *
The from (select
Regexp_replace (regexp_replace (a.k freason, '[(] [^ ()] * []'), '[(] [^ ()] * []') kfreason, a.u sername, b.u seralias,
P. ost
The from examdetail a left join projectusers b
On b.u sername=a.u sername join
(select aa. Ewid from examworkbreed aa where aa. The typeid='10916'
And aa. Eiid='4 de7f10f7b534aa8b77d836e42942fa8'
And (aa) ebid & gt; '0' or aa. Ebid & lt; '0') - & lt;> Lose the index value
C='AFE237EB77F14468B26D7D5CB0097DE9' and aa. Examajor)
On a.e wid=c.e wid
Where
De7f10f7b534aa8b77d836e42942fa8 b.e iid='4'
F)
Where f.k freason like '% did not answer the attendant wearing a helmet into an equipment check area %';

CodePudding user response:

Don't go SQL index increase a function index will be faster,
  • Related