Skip to content

Instantly share code, notes, and snippets.

@th3james
Created April 30, 2012 12:57
Show Gist options
  • Save th3james/2558102 to your computer and use it in GitHub Desktop.
Save th3james/2558102 to your computer and use it in GitHub Desktop.
Postgres != slowness
# Crazy Slow
UPDATE protected_areas SET criteria = 'Not Applicable' WHERE designation_id != 5;
# Near instant
UPDATE protected_areas SET criteria = 'Not Applicable'
FROM protected_areas AS pa
LEFT OUTER JOIN designations ON pa.designation_id = designations.id
WHERE designations.id = 5 AND pa.designation_id = NULL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment