You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SQL> recreate table test(id int generated by default as identity constraint test_pk primary key, x varchar(50));
SQL> create index test_x on test(x);
SQL> insert into test(x) values('');
SQL> insert into test(x) values('a');
SQL> insert into test(x) values(' a');
SQL> insert into test(x) values('aa');
SQL> commit;
SQL> set plan on;
SQL> set planonly;
SQL> select * from test where x like 'a%';
PLAN (TEST INDEX (TEST_X))
SQL> select * from test where x like 'a_';
PLAN (TEST INDEX (TEST_X))
SQL> select * from test where x like 'a';
PLAN (TEST INDEX (TEST_X))
SQL> ------------------------------------
SQL> select * from test where x similar to 'a%';
PLAN (TEST NATURAL)
SQL> select * from test where x similar to 'a_';
PLAN (TEST NATURAL)
SQL> select * from test where x similar to 'a';
PLAN (TEST NATURAL)
The text was updated successfully, but these errors were encountered:
dyemanov
changed the title
SIMILAR TO does not use index when pattern starts with non-wildcard character (in contrary to LIKE)
SIMILAR TO should use index when pattern starts with non-wildcard character (as LIKE does)
Jun 17, 2022
The text was updated successfully, but these errors were encountered: