Last active
August 29, 2015 13:57
-
-
Save workmaster2n/9572948 to your computer and use it in GitHub Desktop.
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
| SELECT DISTINCT("tracked_points"."decisecond_recorded_at") | |
| FROM "tracked_points" WHERE | |
| "tracked_points"."decisecond_recorded_at" >= 1393987371 | |
| ORDER BY decisecond_recorded_at |
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
| -- Table: tracked_points | |
| -- DROP TABLE tracked_points; | |
| CREATE TABLE tracked_points | |
| ( | |
| id serial NOT NULL, | |
| recorded_at timestamp without time zone, | |
| worker_id integer, | |
| created_at timestamp without time zone NOT NULL, | |
| updated_at timestamp without time zone NOT NULL, | |
| location_id integer NOT NULL, | |
| session_id integer, | |
| frequency integer, | |
| worker_id_checked_at timestamp without time zone, | |
| geom postgis.geometry(PointZ), | |
| zone_checked_at timestamp without time zone, | |
| decisecond_recorded_at numeric(32,1), | |
| CONSTRAINT tracked_points_pkey PRIMARY KEY (id) | |
| ) | |
| WITH ( | |
| OIDS=FALSE | |
| ); | |
| ALTER TABLE tracked_points | |
| OWNER TO arcsite; | |
| -- Index: index_tracked_points_on_decisecond_recorded_at | |
| -- DROP INDEX index_tracked_points_on_decisecond_recorded_at; | |
| CREATE INDEX index_tracked_points_on_decisecond_recorded_at | |
| ON tracked_points | |
| USING btree | |
| (decisecond_recorded_at); | |
| -- Index: index_tracked_points_on_geom | |
| -- DROP INDEX index_tracked_points_on_geom; | |
| CREATE INDEX index_tracked_points_on_geom | |
| ON tracked_points | |
| USING gist | |
| (geom); | |
| -- Index: index_tracked_points_on_recorded_at | |
| -- DROP INDEX index_tracked_points_on_recorded_at; | |
| CREATE INDEX index_tracked_points_on_recorded_at | |
| ON tracked_points | |
| USING btree | |
| (recorded_at); | |
| -- Index: index_tracked_points_on_worker_id | |
| -- DROP INDEX index_tracked_points_on_worker_id; | |
| CREATE INDEX index_tracked_points_on_worker_id | |
| ON tracked_points | |
| USING btree | |
| (worker_id); | |
| -- Index: index_tracked_points_on_worker_id_checked_at | |
| -- DROP INDEX index_tracked_points_on_worker_id_checked_at; | |
| CREATE INDEX index_tracked_points_on_worker_id_checked_at | |
| ON tracked_points | |
| USING btree | |
| (worker_id_checked_at); | |
| -- Index: index_tracked_points_on_zone_checked_at | |
| -- DROP INDEX index_tracked_points_on_zone_checked_at; | |
| CREATE INDEX index_tracked_points_on_zone_checked_at | |
| ON tracked_points | |
| USING btree | |
| (zone_checked_at); | |
| -- Index: index_tracked_points_partial_zone_checked_at | |
| -- DROP INDEX index_tracked_points_partial_zone_checked_at; | |
| CREATE INDEX index_tracked_points_partial_zone_checked_at | |
| ON tracked_points | |
| USING btree | |
| (zone_checked_at); | |
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 | |
| SELECT DISTINCT ON ("tracked_points"."decisecond_recorded_at") decisecond_recorded_at, recorded_at | |
| FROM "tracked_points" WHERE | |
| "tracked_points"."decisecond_recorded_at" >= 1393987371 | |
| ORDER BY decisecond_recorded_at |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
slow_query_explain_analyze: http://explain.depesz.com/s/d6T