Hash Join (cost=1.93..175359.44 rows=152524 width=24) (actual time=0.972..1.085 rows=5 loops=1) Hash Cond: ("outer".template_id = "inner".id) -> Nested Loop (cost=0.00..173069.64 rows=152524 width=24) (actual time=0.274..0.358 rows=5 loops=1) -> Index Scan using idx_d_entered on data (cost=0.00..18024.04 rows=50360 width=16) (actual time=0.210..0.247 rows=1 loops=1) Index Cond: (((('now'::text)::timestamp(6) with time zone)::timestamp without time zone - '00:01:00'::interval) < entered) Filter: (machine_id = 2) -> Index Scan using idx_dv_data_id on data_values (cost=0.00..3.04 rows=3 width=16) (actual time=0.049..0.074 rows=5 loops=1) Index Cond: (data_values.data_id = "outer".id) -> Hash (cost=1.74..1.74 rows=74 width=8) (actual time=0.438..0.438 rows=0 loops=1) -> Seq Scan on datatemplate_intervals (cost=0.00..1.74 rows=74 width=8) (actual time=0.028..0.255 rows=74 loops=1) Total runtime: 1.575 ms (11 rows)