-- This file is just to structure the data. drop table if exists afan_test_t; drop table if exists afan_test; create table afan_test_t( id int auto_increment primary key, the_date varchar(8) not null, prj_id varchar(120) not null, index index_1(the_date,prj_id)); insert into afan_test_t (the_date,prj_id) values('20220101','PRJID01'),('20220101','PRJID02'),('20220101','PRJID03'),('20220101','PRJID04'),('20220101','PRJID05'),('20220101','PRJID05'),('20220101','PRJID06'),('20220101','PRJID07'),('20220101','PRJID08'),('20220101','PRJID09'),('20220101','PRJID10'); insert into afan_test_t (the_date,prj_id) select the_date,prj_id from afan_test_t where prj_id = 'PRJID09'; insert into afan_test_t (the_date,prj_id) select the_date,prj_id from afan_test_t where prj_id = 'PRJID09'; insert into afan_test_t (the_date,prj_id) select the_date,prj_id from afan_test_t where prj_id = 'PRJID09'; insert into afan_test_t (the_date,prj_id) select the_date,prj_id from afan_test_t where prj_id = 'PRJID09'; insert into afan_test_t (the_date,prj_id) select the_date,prj_id from afan_test_t where prj_id = 'PRJID09'; insert into afan_test_t (the_date,prj_id) select the_date,prj_id from afan_test_t where prj_id = 'PRJID10'; insert into afan_test_t (the_date,prj_id) select the_date,prj_id from afan_test_t where prj_id = 'PRJID10'; insert into afan_test_t (the_date,prj_id) select the_date,prj_id from afan_test_t where prj_id = 'PRJID10'; insert into afan_test_t (the_date,prj_id) select the_date,prj_id from afan_test_t where prj_id = 'PRJID10'; insert into afan_test_t (the_date,prj_id) select the_date,prj_id from afan_test_t where prj_id = 'PRJID10'; insert into afan_test_t (the_date,prj_id) select the_date,prj_id from afan_test_t where prj_id = 'PRJID10'; insert into afan_test_t (the_date,prj_id) select the_date,prj_id from afan_test_t where prj_id = 'PRJID10'; insert into afan_test_t (the_date,prj_id) select the_date,prj_id from afan_test_t where prj_id = 'PRJID10'; insert into afan_test_t (the_date,prj_id) select the_date,prj_id from afan_test_t where prj_id = 'PRJID10'; insert into afan_test_t (the_date,prj_id) select the_date,prj_id from afan_test_t where prj_id = 'PRJID10'; insert into afan_test_t (the_date,prj_id) select the_date,prj_id from afan_test_t; insert into afan_test_t (the_date,prj_id) select the_date,prj_id from afan_test_t; insert into afan_test_t (the_date,prj_id) select the_date,prj_id from afan_test_t; insert into afan_test_t (the_date,prj_id) select the_date,prj_id from afan_test_t; create table afan_test like afan_test_t; insert into afan_test (the_date,prj_id) select '20220101',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220102',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220103',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220104',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220105',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220106',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220107',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220108',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220109',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220110',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220111',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220112',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220113',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220114',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220115',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220116',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220117',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220118',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220119',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220120',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220121',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220122',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220123',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220124',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220125',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220126',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220127',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220128',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220129',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220130',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220131',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220201',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220202',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220203',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220204',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220205',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220206',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220207',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220208',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220209',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220210',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220211',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220212',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220213',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220214',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220215',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220216',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220217',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220218',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220219',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220220',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220221',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220222',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220223',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220224',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220225',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220226',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220227',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220228',prj_id from afan_test_t; insert into afan_test (the_date,prj_id) select '20220229',prj_id from afan_test_t; drop table if exists afan_test_t; analyze table afan_test;