Оптимизация SQL как обещал
Для архивных discount_transactions_all*
discount_transactions_iptraffic_all*
после архивации сортировка данных по account_id, к примеру
По хорошему нужно разобраться с first_dtr, но пока нет времени.
Код: Выделить всё
PRIMARY KEY (`id`),
KEY `first_disc` (`discount_date`),
KEY `first_disc1` (`account_id`)
Код: Выделить всё
PRIMARY KEY (`id`),
KEY `first_dtr` (`discount_date`,`account_id`,`slink_id`),
KEY `t_class` (`t_class`),
KEY `account_id` (`account_id`)
Код: Выделить всё
alter table discount_transactions_iptraffic_all_1 order by account_id;