The site costs with the sqlite base. It slows down and there is no possibility to transfer the database to mysql. I found a request because of which there are many problems on the site. It is big and I do not know how to speed it up so that the site works faster. How to speed up the work on sqllite? Thanks in advance.

SELECT test.id AS 'id', test.prefix AS 'prefix', user.id AS 'user_id', variant.id AS 'variant_id', variant.mark AS 'mark' FROM test INNER JOIN testset ON test.id = testset.test_id " . (($prefix !== false) ? 'AND test.prefix = :prefix' : '') . " AND testset.class_id = :class_id INNER JOIN user ON user.class_id = :class_id LEFT JOIN variant ON variant.test_id = test.id AND variant.user_id = user.id ORDER BY test.prefix, user.name, testset.id ")->execute(array( 'class_id' => intval($classId), 'prefix' => $prefix, ))->fetchAll(); 

    1 answer 1

    See EXPLAIN QUERY PLAN