We identified that the performance of a query using some string functions, such as: strpos, position, ... is really bad, even compared to equivalent using regular expressions, such as regexp_like that is in our case 4 times faster than strpos.
Tests have been done on one table (no join), or to specific projections (projection done only on one field with different encoding); profile queries ran from the MC.
Statistics up to date, Database designer: OK
The field (varchar2) has 570 different values; this is a 25M rows table. 600MB compressed.
Select count(distinct *) is running very fast (<1s).
select distinct fieldA is running very fast (<1s).
select distinct strpos(fieldA , 'xxx') is very slow (between 40 to 400 seconds if mixed with other string functions).
select distinct regexp_like (fieldA , 'xxx') is faster (10 seconds)
select fieldA like 'xxx' from... is even faster (7 seconds)
It is as if the function strpos was ran on each record, instead of applying the formula on each distinct.
Is it expected?
NB.
We are using Vertica 7.0.0, but we tried also with the last Vertica SP.
We tested it on a 3-nodes cluster; but also on a 1-node.
Projection we were using: AUTO
Size of the compressed data of the column: few KB.
-------- queries I used and some performance results:
-- original query
SELECTSTRPOS("sqlproxy"."PARTNERPROG_WAS",'XXX') > 0
"none_calculation_8970312171248507_nk" FROM
"t_bok_all_2v"
"sqlproxy" GROUP BY 1 ORDER BY 1 ASC
294 seconds to complete
-- query I was expecting the optimizer to run based on statistics
SELECTSTRPOS("sqlproxy"."PARTNERPROG_WAS",'XXX') > 0
"none_calculation_8970312171248507_nk" FROM
(
select distinct PARTNERPROG_WAS
from "t_bok_all_2v"
) "sqlproxy" GROUP BY 1 ORDER BY 1 ASC
18 seconds to complete
-- query I have to rewrite to:
SELECT("sqlproxy"."PARTNERPROG_WAS" like 'XXX')
"none_calculation_8970312171248507_nk" FROM
"t_bok_all_2v"
"sqlproxy" GROUP BY 1 ORDER BY 1 ASC
4 seconds to complete
This really sounds like a bug/regression, or am I missing anything?
Sign up
Already have an account? Login
Welcome to the Rocket Forum!
Please log in or register:
Employee Login | Registration Member Login | RegistrationEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.