indexing - How to index mysql table with custom field select -
how can index mysql table according given query?
select if( flag in ('a', 'b') , status in ('on'), 'a', flag ) customized_flag, if( agent_group = 'a', 'group_1', 'group_2' ) group, count(*) total mytable type in (1, 2, 3, 4, 5) , publish = 1 , status in ('on', 'deleted', 'expired',) group customized_flag, agency_package_status ;
flag can a,b,c,d
agent_group can a,b,c,d
type integer number
my sample table data shown below
change to
group customized_flag, `group`
add
index(publish, type, status)
Comments
Post a Comment