SET FOREIGN_KEY_CHECKS=0; -- DELETE DATA delete from kpi_c_report_ims WHERE date <= '2025-10-01'; delete from kpi_c_report_upf WHERE date <= '2025-10-01'; delete from kpi_c_report_udm WHERE date <= '2025-10-01'; delete from kpi_c_report_smf WHERE date <= '2025-10-01'; delete from kpi_c_report_pcf WHERE date <= '2025-10-01'; delete from kpi_c_report_amf WHERE date <= '2025-10-01'; delete from kpi_c_report_ausf WHERE date <= '2025-10-01'; delete from kpi_c_report_mme WHERE date <= '2025-10-01'; delete from kpi_c_report_smsc WHERE date <= '2025-10-01'; delete from kpi_report_ims WHERE date <= '2025-10-01'; delete from kpi_report_upf WHERE date <= '2025-10-01'; delete from kpi_report_udm WHERE date <= '2025-10-01'; delete from kpi_report_smf WHERE date <= '2025-10-01'; delete from kpi_report_pcf WHERE date <= '2025-10-01'; delete from kpi_report_amf WHERE date <= '2025-10-01'; delete from kpi_report_ausf WHERE date <= '2025-10-01'; delete from kpi_report_mme WHERE date <= '2025-10-01'; delete from kpi_report_smsc WHERE date <= '2025-10-01'; delete from cdr_event_ims WHERE created_at <= '2025-10-01'; delete from cdr_event_smsc WHERE created_at <= '2025-10-01'; delete from cdr_event_smf WHERE created_at <= '2025-10-01'; delete from ue_event_amf WHERE created_at <= '2025-10-01'; delete from ue_event_mme WHERE created_at <= '2025-10-01'; ALTER TABLE `kpi_c_report_ims` DROP INDEX IF EXISTS `idx_timestamp`; ALTER TABLE `kpi_c_report_upf` DROP INDEX IF EXISTS `idx_timestamp`; ALTER TABLE `kpi_c_report_udm` DROP INDEX IF EXISTS `idx_timestamp`; ALTER TABLE `kpi_c_report_smf` DROP INDEX IF EXISTS `idx_timestamp`; ALTER TABLE `kpi_c_report_pcf` DROP INDEX IF EXISTS `idx_timestamp`; ALTER TABLE `kpi_c_report_amf` DROP INDEX IF EXISTS `idx_timestamp`; ALTER TABLE `kpi_c_report_ausf` DROP INDEX IF EXISTS `idx_timestamp`; ALTER TABLE `kpi_c_report_mme` DROP INDEX IF EXISTS `idx_timestamp`; ALTER TABLE `kpi_report_ims` DROP INDEX IF EXISTS `idx_timestamp`; ALTER TABLE `kpi_report_upf` DROP INDEX IF EXISTS `idx_timestamp`; ALTER TABLE `kpi_report_udm` DROP INDEX IF EXISTS `idx_timestamp`; ALTER TABLE `kpi_report_smf` DROP INDEX IF EXISTS `idx_timestamp`; ALTER TABLE `kpi_report_pcf` DROP INDEX IF EXISTS `idx_timestamp`; ALTER TABLE `kpi_report_amf` DROP INDEX IF EXISTS `idx_timestamp`; ALTER TABLE `kpi_report_ausf` DROP INDEX IF EXISTS `idx_timestamp`; ALTER TABLE `kpi_c_report_mme` DROP INDEX IF EXISTS `idx_timestamp`; ALTER TABLE `kpi_c_report_ims` ADD INDEX IF NOT EXISTS `idx_kpic_ims_rc`(`rm_uid` DESC, `created_at` DESC) USING BTREE COMMENT 'kpi_c_report_ims 报表时间索引'; ALTER TABLE `kpi_c_report_upf` ADD INDEX IF NOT EXISTS `idx_kpic_upf_rc`(`rm_uid` DESC, `created_at` DESC) USING BTREE COMMENT 'kpi_c_report_upf 报表时间索引'; ALTER TABLE `kpi_c_report_udm` ADD INDEX IF NOT EXISTS `idx_kpic_udm_rc`(`rm_uid` DESC, `created_at` DESC) USING BTREE COMMENT 'kpi_c_report_udm 报表时间索引'; ALTER TABLE `kpi_c_report_smf` ADD INDEX IF NOT EXISTS `idx_kpic_smf_rc`(`rm_uid` DESC, `created_at` DESC) USING BTREE COMMENT 'kpi_c_report_smf 报表时间索引'; ALTER TABLE `kpi_c_report_pcf` ADD INDEX IF NOT EXISTS `idx_kpic_pcf_rc`(`rm_uid` DESC, `created_at` DESC) USING BTREE COMMENT 'kpi_c_report_pcf 报表时间索引'; ALTER TABLE `kpi_c_report_amf` ADD INDEX IF NOT EXISTS `idx_kpic_amf_rc`(`rm_uid` DESC, `created_at` DESC) USING BTREE COMMENT 'kpi_c_report_amf 报表时间索引'; ALTER TABLE `kpi_c_report_ausf` ADD INDEX IF NOT EXISTS `idx_kpic_ausf_rc`(`rm_uid` DESC, `created_at` DESC) USING BTREE COMMENT 'kpi_c_report_ausf 报表时间索引'; ALTER TABLE `kpi_report_ims` ADD INDEX IF NOT EXISTS `idx_kpi_report_ims_rc`(`rm_uid` DESC, `created_at` DESC) USING BTREE COMMENT 'kpi_report_ims 报表时间索引'; ALTER TABLE `kpi_report_upf` ADD INDEX IF NOT EXISTS `idx_kpi_report_upf_rc`(`rm_uid` DESC, `created_at` DESC) USING BTREE COMMENT 'kpi_report_upf 报表时间索引'; ALTER TABLE `kpi_report_udm` ADD INDEX IF NOT EXISTS `idx_kpi_report_udm_rc`(`rm_uid` DESC, `created_at` DESC) USING BTREE COMMENT 'kpi_report_udm 报表时间索引'; ALTER TABLE `kpi_report_smf` ADD INDEX IF NOT EXISTS `idx_kpi_report_smf_rc`(`rm_uid` DESC, `created_at` DESC) USING BTREE COMMENT 'kpi_report_smf 报表时间索引'; ALTER TABLE `kpi_report_pcf` ADD INDEX IF NOT EXISTS `idx_kpi_report_pcf_rc`(`rm_uid` DESC, `created_at` DESC) USING BTREE COMMENT 'kpi_report_pcf 报表时间索引'; ALTER TABLE `kpi_report_amf` ADD INDEX IF NOT EXISTS `idx_kpi_report_amf_rc`(`rm_uid` DESC, `created_at` DESC) USING BTREE COMMENT 'kpi_report_amf 报表时间索引'; ALTER TABLE `kpi_report_ausf` ADD INDEX IF NOT EXISTS `idx_kpi_report_ausf_rc`(`rm_uid` DESC, `created_at` DESC) USING BTREE COMMENT 'kpi_report_ausf 报表时间索引'; ALTER TABLE `cdr_event_ims` ADD INDEX IF NOT EXISTS `idx_cdr_event_ims_rc`(`rm_uid` DESC, `created_at` DESC) USING BTREE COMMENT 'cdr_event_ims 报表时间索引'; ALTER TABLE `cdr_event_smsc` ADD INDEX IF NOT EXISTS `idx_cdr_event_smsc_rc`(`rm_uid` DESC, `created_at` DESC) USING BTREE COMMENT 'cdr_event_smsc 报表时间索引'; ALTER TABLE `cdr_event_smf` ADD INDEX IF NOT EXISTS `idx_cdr_event_smf_rc`(`rm_uid` DESC, `created_at` DESC) USING BTREE COMMENT 'cdr_event_smf 报表时间索引'; ALTER TABLE `ue_event_amf` ADD INDEX IF NOT EXISTS `idx_ue_event_amf_rc`(`rm_uid` DESC, `created_at` DESC) USING BTREE COMMENT 'ue_event_amf 报表时间索引'; ALTER TABLE `ue_event_mme` ADD INDEX IF NOT EXISTS `idx_ue_event_mme_rc`(`rm_uid` DESC, `created_at` DESC) USING BTREE COMMENT 'ue_event_mme 报表时间索引'; SET FOREIGN_KEY_CHECKS = 1;