explain.depesz.com

PostgreSQL's explain analyze made readable

Result: qXnJ

Settings
# exclusive inclusive rows x rows loops node
1. 0.003 0.192 ↑ 1.0 1 1

Nested Loop (cost=9.19..17.27 rows=1 width=28) (actual time=0.192..0.192 rows=1 loops=1)

2. 0.006 0.164 ↑ 1.0 1 1

GroupAggregate (cost=8.62..8.66 rows=1 width=28) (actual time=0.164..0.164 rows=1 loops=1)

  • Group Key: tb2.device_id, tb2.sensor_tag_id, tb2.sensor_index, ((floor(((tb2.sensor_timestamp / 900000))::double precision) * '900000'::double precision))
3. 0.028 0.158 ↓ 3.0 3 1

Sort (cost=8.62..8.62 rows=1 width=28) (actual time=0.158..0.158 rows=3 loops=1)

  • Sort Key: ((floor(((tb2.sensor_timestamp / 900000))::double precision) * '900000'::double precision))
  • Sort Method: quicksort Memory: 25kB
4. 0.130 0.130 ↓ 3.0 3 1

Index Only Scan using device_sensor_value_pkey on device_sensor_value tb2 (cost=0.57..8.61 rows=1 width=28) (actual time=0.128..0.130 rows=3 loops=1)

  • Index Cond: ((device_id = 192) AND (sensor_tag_id = 75) AND (sensor_index = 0) AND (sensor_timestamp >= '1561939200000'::bigint) AND (sensor_timestamp < '1561940100000'::bigint))
  • Heap Fetches: 0
5. 0.025 0.025 ↑ 1.0 1 1

Index Scan using device_sensor_value_pkey on device_sensor_value orig (cost=0.57..8.60 rows=1 width=28) (actual time=0.025..0.025 rows=1 loops=1)

  • Index Cond: ((device_id = tb2.device_id) AND (sensor_tag_id = tb2.sensor_tag_id) AND (sensor_index = tb2.sensor_index) AND (sensor_timestamp = (max(tb2.sensor_timestamp))))