Last active
August 29, 2015 14:16
-
-
Save Jwata/3949de4a604d092f92bd to your computer and use it in GitHub Desktop.
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
select t1.job_posting_id from (select jp.id as job_posting_id from job_posting jp where jp.`valid_to` > '2015-03-03 00:34:52.404' AND jp.`occupation_type` IN ('restaurant') AND NOT jp.`occupation_type` = 'night') t1 | |
inner join | |
( | |
select job_posting_id from | |
(select l.job_posting_id from location l where l.locality_id IN (1113)) t2 | |
inner join | |
(select f.job_posting_id from feature f where f.title IN ('dailypayment')) t3 | |
using (job_posting_id) | |
) t4 | |
using (job_posting_id) |
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
select t_loc.job_posting_id from | |
(SELECT loc.`job_posting_id` FROM `location` loc WHERE loc.`locality_id` IN (1114)) t_loc | |
inner join | |
( | |
select job_posting_id from | |
( | |
select jp.id as job_posting_id from job_posting jp | |
where jp.`valid_to` > '2015-03-03 07:50:02.293' | |
AND jp.`occupation_type` IN ('planning_management', 'education_translation', 'consulting_finance_estate', 'it', 'editor_designer', 'construction', 'pharmacy_food_chemical', 'manufacturing', 'transport_security','other') | |
) t_jp | |
inner join | |
( | |
select job_posting_id from | |
(select f.job_posting_id from feature f where f.title IN ('restonweekend')) t_ft | |
inner join | |
(select o.job_posting_id from offer_type o where o.offer_type IN ('fulltime')) t_o | |
using (job_posting_id) | |
) t_ft_o | |
using (job_posting_id) | |
) t_ft_o_jp | |
using (job_posting_id) limit 1000 |
the second sql shorten the longest query from 58.9
sec to 25.3
sec
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it takes
6.816
secthe original query took
12.3
sec