Skip to content

Instantly share code, notes, and snippets.

@hampelm
Last active December 13, 2015 18:58
Show Gist options
  • Save hampelm/4958637 to your computer and use it in GitHub Desktop.
Save hampelm/4958637 to your computer and use it in GitHub Desktop.
Sample nodetiles queries
-- Make sure indexes are set up
CREATE INDEX responses_the_geom_gist ON responses USING GIST (the_geom);
vacuum analyze responses;
-- Set on or off to test if the sequential scan is faster
SET ENABLE_SEQSCAN=OFF;
-- Wider query
EXPLAIN ANALYZE SELECT ST_AsGeoJson(the_geom) as geometry,* FROM responses WHERE the_geom && ST_MakeEnvelope(-83.18847656250001,42.39100860920504, -82.92480468750001,42.585444257384886);
-- Closer query
EXPLAIN ANALYZE SELECT ST_AsGeoJson(the_geom) as geometry,* FROM responses WHERE the_geom && ST_MakeEnvelope(-83.02436828613283,42.4351133853526, -83.02024841308594,42.438153950765916);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment