Created
April 11, 2014 12:04
-
-
Save frozenspider/10462674 to your computer and use it in GitHub Desktop.
Slow and fast queries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generated by Slick (select terms optimized for clarity) | |
# Takes 47034 ms | |
SELECT * | |
FROM ( | |
SELECT x281.id | |
FROM `comp_proposal_raw_batch_comp_proposal_raw` x282, `comp_proposal_raw` x281 | |
WHERE (x282.`comp_proposal_raw_batch_proposals_id` = 4936) AND (x281.`id` = x282.`comp_proposal_raw_id`) | |
) x187 | |
INNER JOIN ( | |
SELECT * | |
FROM `comp_proposal_raw` x283 | |
) x280 ON x187.id = x280.`original_id` | |
ORDER BY x280.`id` | |
LIMIT 2 | |
# Hand-changed | |
# Takes 16 ms | |
SELECT * | |
FROM ( | |
SELECT x281.id | |
FROM `comp_proposal_raw_batch_comp_proposal_raw` x282, `comp_proposal_raw` x281 | |
WHERE (x282.`comp_proposal_raw_batch_proposals_id` = 4936) AND (x281.`id` = x282.`comp_proposal_raw_id`) | |
) x187 | |
INNER JOIN `comp_proposal_raw` x280 ON x187.id = x280.`original_id` | |
ORDER BY x280.`id` | |
LIMIT 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment