Skip to content

Instantly share code, notes, and snippets.

@lseppala
Created October 30, 2015 22:06
Show Gist options
  • Select an option

  • Save lseppala/0a149716771da03ecb8b to your computer and use it in GitHub Desktop.

Select an option

Save lseppala/0a149716771da03ecb8b to your computer and use it in GitHub Desktop.
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Unique (cost=60.36..60.36 rows=1 width=28) (actual time=1.736..1.928 rows=2 loops=1)
-> Sort (cost=60.36..60.36 rows=1 width=28) (actual time=1.735..1.815 rows=1278 loops=1)
Sort Key: ds_sensor.datastream_id, temp."time"
Sort Method: quicksort Memory: 148kB
-> Nested Loop (cost=4.79..60.35 rows=1 width=28) (actual time=0.069..0.876 rows=1278 loops=1)
-> Nested Loop (cost=4.79..40.33 rows=1 width=24) (actual time=0.047..0.107 rows=4 loops=1)
-> Nested Loop (cost=4.64..39.68 rows=3 width=28) (actual time=0.034..0.079 rows=11 loops=1)
-> Nested Loop (cost=4.49..39.04 rows=3 width=24) (actual time=0.029..0.055 rows=11 loops=1)
-> Nested Loop (cost=4.33..37.37 rows=4 width=4) (actual time=0.020..0.038 rows=5 loops=1)
-> Bitmap Heap Scan on device (cost=4.18..12.64 rows=4 width=4) (actual time=0.013..0.014 rows=6 loops=1)
Recheck Cond: (org_id = 2)
Heap Blocks: exact=1
-> Bitmap Index Scan on user_to_device (cost=0.00..4.18 rows=4 width=0) (actual time=0.009..0.009 rows=6 loops=1)
Index Cond: (org_id = 2)
-> Index Scan using sensor_device_id on sensor (cost=0.15..6.17 rows=1 width=8) (actual time=0.002..0.003 rows=1 loops=6)
Index Cond: (device_id = device.id)
-> Index Only Scan using datastream_from_sensor_sensor_id_datastream_id_key on datastream_from_sensor ds_sensor (cost=0.15..0.34 rows=8 width=20) (actual time=0.002..0.003 rows=2 loops=5)
Index Cond: (sensor_id = sensor.id)
Heap Fetches: 11
-> Index Scan using datastream_pkey on datastream (cost=0.15..0.20 rows=1 width=20) (actual time=0.001..0.002 rows=1 loops=11)
Index Cond: (id = ds_sensor.datastream_id)
-> Index Scan using datastream_source_category_pkey on datastream_source_category (cost=0.15..0.20 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=11)
Index Cond: (id = datastream.datastream_source_category_id)
Filter: (name = 'temperature celsius'::text)
Rows Removed by Filter: 1
-> Append (cost=0.00..13.62 rows=640 width=16) (actual time=0.009..0.137 rows=320 loops=4)
-> Seq Scan on datastream_temperature temp (cost=0.00..0.00 rows=1 width=16) (actual time=0.000..0.000 rows=0 loops=4)
Filter: (sensor.id = sensor_id)
-> Index Only Scan using datastream_temperature_2015_05_covering on datastream_temperature_2015_05 temp_1 (cost=0.15..0.36 rows=9 width=16) (actual time=0.001..0.001 rows=0 loops=4)
Index Cond: (sensor_id = sensor.id)
Heap Fetches: 0
-> Index Only Scan using datastream_temperature_2015_06_covering on datastream_temperature_2015_06 temp_2 (cost=0.15..0.36 rows=9 width=16) (actual time=0.000..0.000 rows=0 loops=4)
Index Cond: (sensor_id = sensor.id)
Heap Fetches: 0
-> Index Only Scan using datastream_temperature_2015_07_covering on datastream_temperature_2015_07 temp_3 (cost=0.15..0.36 rows=9 width=16) (actual time=0.001..0.001 rows=0 loops=4)
Index Cond: (sensor_id = sensor.id)
Heap Fetches: 0
-> Index Scan using datastream_temperature_2015_10_by_sensor on datastream_temperature_2015_10 temp_4 (cost=0.28..12.55 rows=612 width=16) (actual time=0.004..0.103 rows=320 loops=4)
Index Cond: (sensor_id = sensor.id)
Planning time: 1.973 ms
Execution time: 2.091 ms
(41 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment