[MDEV-16683] regexp can push down range scan index when starting with a constant Created: 2018-07-04  Updated: 2018-07-04

Status: Open
Project: MariaDB Server
Component/s: Optimizer
Fix Version/s: None

Type: Task Priority: Major
Reporter: VAROQUI Stephane Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: performance


 Description   

explain SELECT MAX(SUBSTRING(x0_.username FROM 11) * 1) AS sclr_0 FROM xcart_customers x0_ WHERE (x0_.username REGEXP 'tuttofare.[0-9]+') = 1;
------------------------------------------------------------------------------------------+

id select_type table type possible_keys key key_len ref rows Extra

------------------------------------------------------------------------------------------+

1 SIMPLE x0_ index NULL username 386 NULL 4196194 Using where; Using index

------------------------------------------------------------------------------------------+

explain SELECT MAX(SUBSTRING(x0_.username FROM 11) * 1) AS sclr_0 FROM xcart_customers x0_ WHERE (x0_.username REGEXP 'tuttofare.[0-9]+')=1 and x0_.username like 'tuttofare%' ;
---------------------------------------------------------------------------------------+

id select_type table type possible_keys key key_len ref rows Extra

---------------------------------------------------------------------------------------+

1 SIMPLE x0_ range username username 386 NULL 3359 Using where; Using index

---------------------------------------------------------------------------------------+


Generated at Thu Feb 08 08:30:46 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.