Created
August 20, 2014 16:18
-
-
Save wkalt/b229632a403ae2efc260 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
EXPLAIN ANALYZE | |
delete from fact_values where ID NOT IN (SELECT fact_value_id FROM facts); | |
EXPLAIN ANALYZE | |
delete from fact_paths where ID NOT IN (SELECT path_id FROM fact_values); | |
EXPLAIN ANALYZE | |
delete from resource_params_cache where NOT EXISTS (SELECT * FROM catalog_resources cr WHERE cr.resource=resource_params_cache.resource); | |
EXPLAIN ANALYZE | |
delete from environments where ID NOT IN | |
(SELECT environment_id FROM catalogs | |
UNION ALL | |
SELECT environment_id FROM reports | |
UNION ALL | |
SELECT environment_id FROM factsets); | |
EXPLAIN ANALYZE | |
delete from report_statuses where ID NOT IN (SELECT status_id FROM reports); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment