表结构
create table assign_idx(
it_id BIGINT UNSIGNED NOT NULL,
cat_id BIGINT UNSIGNED NOT NULL,
c_type BIGINT UNSIGNED NOT NULL,
c_user_id BIGINT UNSIGNED NOT NULL DEFAULT 0,
l_user_id BIGINT UNSIGNED NOT NULL DEFAULT 0,
create_time BIGINT UNSIGNED NOT NULL,
PRIMARY KEY(it_id),
INDEX idx_c_type_cat_c_user_time(c_type, cat_id, c_user_id, create_time)
) ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 default charset utf8mb4;
explain select it_id from assign_idx where c_user_id = 0 and l_user_id != 3333 and (c_type, cat_id) in ((30, 1), (30, 2), (30, 3), (20, 4), (20, 6), (20, 9), (20, 10)) order by create_time asc limit 1;
explain 结果 总有 filesort 如何破