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
If both of unique index need to double scan, we should better choose the unique index which can match all of where predicates.
The reason is that if the unique index can match the all of where predicates, it will skip the double scan when the qualify row is zero.
For example
create table
CREATE TABLE t ( a int NOT NULL , b int NOT NULL,
c varchar(64) NOT NULL , d varchar(64) NOT NULL ,
UNIQUE KEY ua (a),
UNIQUE KEY uab (a, b));
query
select * from t where a=1 and b=1;
choose the uab index
uab index is better than ua. When there is no row can match the where predicates "a=1 and b=1", the uab index can skip the double scan while the ua index can not.
"Point_Get 1.00 root table:t, index:uab(a, b) "
The text was updated successfully, but these errors were encountered:
Enhancement
If both of unique index need to double scan, we should better choose the unique index which can match all of where predicates.
The reason is that if the unique index can match the all of where predicates, it will skip the double scan when the qualify row is zero.
For example
uab index is better than ua. When there is no row can match the where predicates "a=1 and b=1", the uab index can skip the double scan while the ua index can not.
The text was updated successfully, but these errors were encountered: