Skip to content

Instantly share code, notes, and snippets.

@paul-millar
Created April 17, 2016 04:55
Show Gist options
  • Save paul-millar/82fff758ddc8425ec17c53f1b8c924d9 to your computer and use it in GitHub Desktop.
Save paul-millar/82fff758ddc8425ec17c53f1b8c924d9 to your computer and use it in GitHub Desktop.
Started GET "/sensors" for 127.0.0.1 at 2016-04-17 14:52:51 +1000
Processing by SensorsController#index as HTML
User Load (2.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
Sensor Load (4.2ms) SELECT "sensors".* FROM "sensors"
Log Load (9636.8ms) SELECT "logs".* FROM "logs" WHERE "logs"."id" IN (SELECT MAX(id) FROM "logs" GROUP BY sensor_id)
EXPLAIN (2.0ms) EXPLAIN SELECT "logs".* FROM "logs" WHERE "logs"."id" IN (SELECT MAX(id) FROM "logs" GROUP BY sensor_id)
EXPLAIN for: SELECT "logs".* FROM "logs" WHERE "logs"."id" IN (SELECT MAX(id) FROM "logs" GROUP BY sensor_id)
QUERY PLAN
-----------------------------------------------------------------------------------------
Nested Loop (cost=705950.15..707475.66 rows=180 width=53)
-> HashAggregate (cost=705949.71..705951.51 rows=180 width=4)
Group Key: max(logs_1.id)
-> HashAggregate (cost=705945.66..705947.46 rows=180 width=8)
Group Key: logs_1.sensor_id
-> Seq Scan on logs logs_1 (cost=0.00..568768.44 rows=27435444 width=8)
-> Index Scan using logs_pkey on logs (cost=0.44..8.46 rows=1 width=53)
Index Cond: (id = (max(logs_1.id)))
(8 rows)
Rendered orphaned_sensors/index.html.haml within layouts/application (142.0ms)
Rendered application/_header.html.haml (6.3ms)
Rendered application/_footer.html.haml (1.4ms)
Completed 200 OK in 10097.8ms (Views: 259.4ms | ActiveRecord: 9673.8ms)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment