clear markdown feedback
clear markdown feedback
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 3799226 fiddles created (41700 in the last week).

create table test ( id int not null auto_increment primary key, dt datetime, hdt int as (hour(dt)), index idx1 (dt), index idx2 (hdt) )
 hidden batch(es)


insert into test (dt) with recursive cte as (select 1 num union all select num+1 from cte where num < 1000) select now() + interval num minute from cte
 hidden batch(es)


explain select * from test where hour(dt)=0
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE test ref idx2 idx2 5 const 60 100.00
 hidden batch(es)


explain select * from test where hdt=0
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
1 SIMPLE test ref idx2 idx2 5 const 60 100.00
 hidden batch(es)