Created
May 23, 2025 10:11
-
-
Save mvdbeek/becf93f9df6f3a764b878eae4f31fc3a to your computer and use it in GitHub Desktop.
optimized input subquery
This file contains hidden or 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
EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS, FORMAT JSON) SELECT | |
filtered_jobs_subquery.job_id, | |
filtered_jobs_subquery."reference_genome|history_item_152775960", | |
filtered_jobs_subquery."library|input_1_152726579" | |
FROM | |
( | |
SELECT | |
job_ids_subquery.job_id AS job_id, | |
job_ids_subquery."reference_genome|history_item_152775960" AS "reference_genome|history_item_152775960", | |
job_ids_subquery."library|input_1_152726579" AS "library|input_1_152726579" | |
FROM | |
( | |
SELECT | |
job.id AS job_id, | |
job_to_input_dataset_1.dataset_id AS "reference_genome|history_item_152775960", | |
job_to_input_dataset_2.dataset_id AS "library|input_1_152726579" | |
FROM | |
job | |
JOIN job_to_input_dataset AS job_to_input_dataset_1 ON job_to_input_dataset_1.job_id = job.id | |
JOIN history_dataset_association AS history_dataset_association_1 ON job_to_input_dataset_1.dataset_id = history_dataset_association_1.id | |
JOIN history_dataset_association AS history_dataset_association_2 ON history_dataset_association_2.dataset_id = history_dataset_association_1.dataset_id | |
JOIN job_to_input_dataset AS job_to_input_dataset_2 ON job_to_input_dataset_2.job_id = job.id | |
JOIN history_dataset_association AS history_dataset_association_3 ON job_to_input_dataset_2.dataset_id = history_dataset_association_3.id | |
JOIN history_dataset_association AS history_dataset_association_4 ON history_dataset_association_4.dataset_id = history_dataset_association_3.dataset_id | |
WHERE | |
job_to_input_dataset_1.name IN ( | |
'reference_genome|history_item', | |
'history_item' | |
) | |
AND history_dataset_association_2.id = 152775960 | |
AND ( | |
( | |
job_to_input_dataset_1.dataset_version IN ( | |
0, history_dataset_association_1.version | |
) | |
OR history_dataset_association_1.update_time < job.create_time | |
) | |
AND history_dataset_association_1.extension = history_dataset_association_2.extension | |
AND history_dataset_association_1.name = history_dataset_association_2.name | |
OR history_dataset_association_1.id IN ( | |
SELECT | |
history_dataset_association.id | |
FROM | |
history_dataset_association, | |
history_dataset_association_history AS history_dataset_association_history_1 | |
WHERE | |
history_dataset_association.id = history_dataset_association_history_1.history_dataset_association_id | |
AND history_dataset_association_history_1.name = history_dataset_association_2.name | |
AND history_dataset_association_history_1.extension = history_dataset_association_2.extension | |
AND job_to_input_dataset_1.dataset_version = history_dataset_association_history_1.version | |
AND history_dataset_association_history_1.metadata = history_dataset_association_2.metadata | |
) | |
) | |
AND ( | |
history_dataset_association_1.deleted = false | |
OR history_dataset_association_2.deleted = false | |
) | |
AND job_to_input_dataset_2.name IN ('library|input_1', 'input_1') | |
AND history_dataset_association_4.id = 152726579 | |
AND ( | |
( | |
job_to_input_dataset_2.dataset_version IN ( | |
0, history_dataset_association_3.version | |
) | |
OR history_dataset_association_3.update_time < job.create_time | |
) | |
AND history_dataset_association_3.extension = history_dataset_association_4.extension | |
AND history_dataset_association_3.name = history_dataset_association_4.name | |
OR history_dataset_association_3.id IN ( | |
SELECT | |
history_dataset_association.id | |
FROM | |
history_dataset_association, | |
history_dataset_association_history AS history_dataset_association_history_2 | |
WHERE | |
history_dataset_association.id = history_dataset_association_history_2.history_dataset_association_id | |
AND history_dataset_association_history_2.name = history_dataset_association_4.name | |
AND history_dataset_association_history_2.extension = history_dataset_association_4.extension | |
AND job_to_input_dataset_2.dataset_version = history_dataset_association_history_2.version | |
AND history_dataset_association_history_2.metadata = history_dataset_association_4.metadata | |
) | |
) | |
AND ( | |
history_dataset_association_3.deleted = false | |
OR history_dataset_association_4.deleted = false | |
) | |
GROUP BY | |
job.id, | |
job_to_input_dataset_1.dataset_id, | |
job_to_input_dataset_2.dataset_id | |
) AS job_ids_subquery | |
JOIN job ON job.id = job_ids_subquery.job_id | |
JOIN history ON job.history_id = history.id | |
JOIN job_parameter AS job_parameter_1 ON job.id = job_parameter_1.job_id | |
JOIN job_parameter AS job_parameter_2 ON job.id = job_parameter_2.job_id | |
JOIN job_parameter AS job_parameter_3 ON job.id = job_parameter_3.job_id | |
JOIN job_parameter AS job_parameter_4 ON job.id = job_parameter_4.job_id | |
WHERE | |
job.tool_id = 'toolshed.g2.bx.psu.edu/repos/iuc/hisat2/hisat2/2.2.1+galaxy1' | |
AND ( | |
job.user_id = 392010 | |
OR history.published = true | |
) | |
AND job.copied_from_job_id IS NULL | |
AND job.tool_version = '2.2.1+galaxy1' | |
AND job.state IN ('ok') | |
AND job.id = job_parameter_1.job_id | |
AND job_parameter_1.name = 'reference_genome' | |
AND job_parameter_1.value LIKE '{"__current_case__": 1, "history_item": {"values": [{"id": %, "src": "hda"}]}, "source": "history"}' | |
AND job.id = job_parameter_2.job_id | |
AND job_parameter_2.name = 'library' | |
AND job_parameter_2.value LIKE '{"__current_case__": 0, "input_1": {"values": [{"id": %, "src": "hda"}]}, "rna_strandness": "", "type": "single"}' | |
AND job.id = job_parameter_3.job_id | |
AND job_parameter_3.name = 'sum' | |
AND job_parameter_3.value = '{"new_summary": false, "summary_file": false}' | |
AND job.id = job_parameter_4.job_id | |
AND job_parameter_4.name = 'adv' | |
AND job_parameter_4.value = '{"alignment_options": {"__current_case__": 0, "alignment_options_selector": "defaults"}, "input_options": {"__current_case__": 0, "input_options_selector": "defaults"}, "other_options": {"__current_case__": 0, "other_options_selector": "defaults"}, "output_options": {"__current_case__": 0, "output_options_selector": "defaults"}, "reporting_options": {"__current_case__": 0, "reporting_options_selector": "defaults"}, "sam_options": {"__current_case__": 0, "sam_options_selector": "defaults"}, "scoring_options": {"__current_case__": 0, "scoring_options_selector": "defaults"}, "spliced_options": {"__current_case__": 0, "spliced_options_selector": "defaults"}}' | |
) AS filtered_jobs_subquery | |
WHERE | |
NOT ( | |
EXISTS ( | |
SELECT | |
* | |
FROM | |
job_to_output_dataset_collection, | |
history_dataset_collection_association | |
WHERE | |
job_to_output_dataset_collection.job_id = filtered_jobs_subquery.job_id | |
AND job_to_output_dataset_collection.dataset_collection_id = history_dataset_collection_association.id | |
AND history_dataset_collection_association.deleted = true | |
) | |
) | |
AND NOT ( | |
EXISTS ( | |
SELECT | |
* | |
FROM | |
job_to_output_dataset, | |
history_dataset_association | |
WHERE | |
job_to_output_dataset.job_id = filtered_jobs_subquery.job_id | |
AND job_to_output_dataset.dataset_id = history_dataset_association.id | |
AND history_dataset_association.deleted = true | |
) | |
) | |
ORDER BY | |
filtered_jobs_subquery.job_id DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment