下面的查询在 17 秒内在视图中执行。有 450,000 行。我在连接的两列上有一个索引,它们是 FK。连接列是 BIGINTS。有没有办法让这家伙加速?
SELECT c.id, sce.user_id
FROM sims_classroom c
JOIN sims_class_enrollment sce ON c.id = sce.classroom_id
解释
'1', 'SIMPLE', 'c', 'index', 'PRIMARY', 'PRIMARY', '8', NULL, '211213', 'Using index'
'1', 'SIMPLE', 'sce', 'ref', 'fk_class_enrollment_classroom_id', 'fk_class_enrollment_classroom_id', '9', 'ngsp.c.id', '1', 'Using where'
行
sims_classroom = 200100
sims_class_enrollment = 476396