Re: Problem with performance!
Posted in 1998
In article <35112472.91C1DAE3@mais.si>,
marko kopac <marko.kopac@mais.si> wrote:
>Hello!
>
>Could anybody help me!!!
>
>How to make my SQL quicker: SELECT * FROM tablex WHERE field1 MATCHES
>'[K,k][O,o][P,p]*'
On my system:-
select * from my_table where char_field matches 'KOP*' union
select * from my_table where char_field matches 'KOp*' union
select * from my_table where char_field matches 'KoP*' union
select * from my_table where char_field matches 'Kop*' union
select * from my_table where char_field matches 'kOP*' union
select * from my_table where char_field matches 'kOp*' union
select * from my_table where char_field matches 'koP*' union
select * from my_table where char_field matches 'kop*'
into temp t1 with no log;
took 2 seconds to locate 13 rows, but
select * from my_table where char_field matches '[K,k][O,o][P,p]*'
into temp t2 with no log;
took 14 seconds to find the same 13 rows (my_table has c. 313,000 rows,
and there is an index on char_field of course).
Matches aren't bad per se, but matches with a wildcard at the front
usually are.
- Paul (not a spokesman, disclaims everything, etc)