explain.depesz.com

PostgreSQL's explain analyze made readable

Result: sbva : gochang-prod

Settings
# exclusive inclusive rows x rows loops node
1. 0.524 31,554.583 ↑ 1.0 100 1

Limit (cost=11,585.05..35,496.62 rows=100 width=3,898) (actual time=2,477.578..31,554.583 rows=100 loops=1)

  • Output: cd.device_id, cd.customer_id, (lower(cd.duration)), (upper(cd.duration)), ((((((COALESCE(cd.id, 0))::text || '-'::text) || (COALESCE(cd.customer_id, 0))::text) || '-'::text) || (COALESCE(cd.device_id, 0))::text)), (floor(((CASE WHEN ((upper(cd.duration)) IS NULL) THEN (SubPlan 1) WHEN ((upper(cd.duration)) IS NOT NULL) THEN (SubPlan 2) ELSE NULL::numeric END)::text)::numeric)), (floor(((CASE WHEN ((upper(cd.duration)) IS NULL) THEN (SubPlan 3) WHEN ((upper(cd.duration)) IS NOT NULL) THEN (SubPlan 4) ELSE NULL::numeric END)::text)::numeric)), (CASE WHEN ((upper(cd.duration)) IS NULL) THEN (SubPlan 5) WHEN ((upper(cd.duration)) IS NOT NULL) THEN (SubPlan 6) ELSE NULL::timestamp with time zone END), ((((floor(((CASE WHEN ((upper(cd.duration)) IS NULL) THEN (SubPlan 7) WHEN ((upper(cd.duration)) IS NOT NULL) THEN (SubPlan 8) ELSE NULL::numeric END)::text)::numeric))::text)::numeric - ((floor(((CASE WHEN ((upper(cd.duration)) IS NULL) THEN (SubPlan 9) WHEN ((upper(cd.duration)) IS NOT NULL) THEN (SubPlan 10) ELSE NULL::numeric END)::text)::numeric))::text)::numeric)), device.id, device.active, device.eid, device.entity_id, device.address_id, device.device_type_id, device.device_group_id, device.parent_id, device.communication_status_id, device.last_seen, device.created, device.updated, device.deleted, device.update_user_id, device.installed, device.application_profile_id, device.serial, device.radio_id, device.first_seen, address.id, address.street_address_1, address.street_address_2, address.country_id, address.state_id, address.city, address.post_code, address.gps_lat, address.gps_lng, address.created, address.updated, address.deleted, address.update_user_id, customer.id, customer.entity_id, customer.reference, customer.name, customer.phonetic_name, customer.contact_1, customer.contact_2, customer.contact_3, customer.comment, customer.street_address_1, customer.street_address_2, customer.country_id, customer.state_id, customer.city, customer.post_code, customer.phone, customer.phone_mobile, customer.email, customer.prism, customer.extras, customer.created, customer.updated, customer.deleted, customer.update_user_id
  • Buffers: shared hit=2886947
2. 9.874 31,554.059 ↑ 28.7 100 1

Result (cost=11,585.05..698,325.46 rows=2,872 width=3,898) (actual time=2,477.569..31,554.059 rows=100 loops=1)

  • Output: cd.device_id, cd.customer_id, (lower(cd.duration)), (upper(cd.duration)), ((((((COALESCE(cd.id, 0))::text || '-'::text) || (COALESCE(cd.customer_id, 0))::text) || '-'::text) || (COALESCE(cd.device_id, 0))::text)), floor(((CASE WHEN ((upper(cd.duration)) IS NULL) THEN (SubPlan 1) WHEN ((upper(cd.duration)) IS NOT NULL) THEN (SubPlan 2) ELSE NULL::numeric END)::text)::numeric), floor(((CASE WHEN ((upper(cd.duration)) IS NULL) THEN (SubPlan 3) WHEN ((upper(cd.duration)) IS NOT NULL) THEN (SubPlan 4) ELSE NULL::numeric END)::text)::numeric), CASE WHEN ((upper(cd.duration)) IS NULL) THEN (SubPlan 5) WHEN ((upper(cd.duration)) IS NOT NULL) THEN (SubPlan 6) ELSE NULL::timestamp with time zone END, (((floor(((CASE WHEN ((upper(cd.duration)) IS NULL) THEN (SubPlan 7) WHEN ((upper(cd.duration)) IS NOT NULL) THEN (SubPlan 8) ELSE NULL::numeric END)::text)::numeric))::text)::numeric - ((floor(((CASE WHEN ((upper(cd.duration)) IS NULL) THEN (SubPlan 9) WHEN ((upper(cd.duration)) IS NOT NULL) THEN (SubPlan 10) ELSE NULL::numeric END)::text)::numeric))::text)::numeric), device.id, device.active, device.eid, device.entity_id, device.address_id, device.device_type_id, device.device_group_id, device.parent_id, device.communication_status_id, device.last_seen, device.created, device.updated, device.deleted, device.update_user_id, device.installed, device.application_profile_id, device.serial, device.radio_id, device.first_seen, address.id, address.street_address_1, address.street_address_2, address.country_id, address.state_id, address.city, address.post_code, address.gps_lat, address.gps_lng, address.created, address.updated, address.deleted, address.update_user_id, customer.id, customer.entity_id, customer.reference, customer.name, customer.phonetic_name, customer.contact_1, customer.contact_2, customer.contact_3, customer.comment, customer.street_address_1, customer.street_address_2, customer.country_id, customer.state_id, customer.city, customer.post_code, customer.phone, customer.phone_mobile, customer.email, customer.prism, customer.extras, customer.created, customer.updated, customer.deleted, customer.update_user_id
  • Buffers: shared hit=2886947
3. 103.329 2,290.419 ↑ 28.7 100 1

Sort (cost=11,585.05..11,592.23 rows=2,872 width=3,794) (actual time=2,290.056..2,290.419 rows=100 loops=1)

  • Output: cd.device_id, cd.customer_id, (lower(cd.duration)), (upper(cd.duration)), ((((((COALESCE(cd.id, 0))::text || '-'::text) || (COALESCE(cd.customer_id, 0))::text) || '-'::text) || (COALESCE(cd.device_id, 0))::text)), device.id, device.active, device.eid, device.entity_id, device.address_id, device.device_type_id, device.device_group_id, device.parent_id, device.communication_status_id, device.last_seen, device.created, device.updated, device.deleted, device.update_user_id, device.installed, device.application_profile_id, device.serial, device.radio_id, device.first_seen, address.id, address.street_address_1, address.street_address_2, address.country_id, address.state_id, address.city, address.post_code, address.gps_lat, address.gps_lng, address.created, address.updated, address.deleted, address.update_user_id, customer.id, customer.entity_id, customer.reference, customer.name, customer.phonetic_name, customer.contact_1, customer.contact_2, customer.contact_3, customer.comment, customer.street_address_1, customer.street_address_2, customer.country_id, customer.state_id, customer.city, customer.post_code, customer.phone, customer.phone_mobile, customer.email, customer.prism, customer.extras, customer.created, customer.updated, customer.deleted, customer.update_user_id
  • Sort Key: customer.reference
  • Sort Method: top-N heapsort Memory: 76kB
  • Buffers: shared hit=157345
4. 260.292 2,187.090 ↓ 8.8 25,387 1

Nested Loop (cost=7,027.19..11,475.28 rows=2,872 width=3,794) (actual time=1,026.345..2,187.090 rows=25,387 loops=1)

  • Output: cd.device_id, cd.customer_id, (lower(cd.duration)), (upper(cd.duration)), ((((((COALESCE(cd.id, 0))::text || '-'::text) || (COALESCE(cd.customer_id, 0))::text) || '-'::text) || (COALESCE(cd.device_id, 0))::text)), device.id, device.active, device.eid, device.entity_id, device.address_id, device.device_type_id, device.device_group_id, device.parent_id, device.communication_status_id, device.last_seen, device.created, device.updated, device.deleted, device.update_user_id, device.installed, device.application_profile_id, device.serial, device.radio_id, device.first_seen, address.id, address.street_address_1, address.street_address_2, address.country_id, address.state_id, address.city, address.post_code, address.gps_lat, address.gps_lng, address.created, address.updated, address.deleted, address.update_user_id, customer.id, customer.entity_id, customer.reference, customer.name, customer.phonetic_name, customer.contact_1, customer.contact_2, customer.contact_3, customer.comment, customer.street_address_1, customer.street_address_2, customer.country_id, customer.state_id, customer.city, customer.post_code, customer.phone, customer.phone_mobile, customer.email, customer.prism, customer.extras, customer.created, customer.updated, customer.deleted, customer.update_user_id
  • Buffers: shared hit=157342
5. 264.197 1,723.702 ↓ 8.8 25,387 1

Nested Loop (cost=7,026.90..10,396.25 rows=2,872 width=3,578) (actual time=1,026.316..1,723.702 rows=25,387 loops=1)

  • Output: cd.device_id, cd.customer_id, (lower(cd.duration)), (upper(cd.duration)), ((((((COALESCE(cd.id, 0))::text || '-'::text) || (COALESCE(cd.customer_id, 0))::text) || '-'::text) || (COALESCE(cd.device_id, 0))::text)), customer.id, customer.entity_id, customer.reference, customer.name, customer.phonetic_name, customer.contact_1, customer.contact_2, customer.contact_3, customer.comment, customer.street_address_1, customer.street_address_2, customer.country_id, customer.state_id, customer.city, customer.post_code, customer.phone, customer.phone_mobile, customer.email, customer.prism, customer.extras, customer.created, customer.updated, customer.deleted, customer.update_user_id, device.id, device.active, device.eid, device.entity_id, device.address_id, device.device_type_id, device.device_group_id, device.parent_id, device.communication_status_id, device.last_seen, device.created, device.updated, device.deleted, device.update_user_id, device.installed, device.application_profile_id, device.serial, device.radio_id, device.first_seen
  • Buffers: shared hit=80943
6. 153.279 1,256.409 ↓ 8.3 25,387 1

Hash Join (cost=7,026.61..7,129.81 rows=3,052 width=3,350) (actual time=1,026.276..1,256.409 rows=25,387 loops=1)

  • Output: cd.device_id, cd.customer_id, (lower(cd.duration)), (upper(cd.duration)), ((((((COALESCE(cd.id, 0))::text || '-'::text) || (COALESCE(cd.customer_id, 0))::text) || '-'::text) || (COALESCE(cd.device_id, 0))::text)), customer.id, customer.entity_id, customer.reference, customer.name, customer.phonetic_name, customer.contact_1, customer.contact_2, customer.contact_3, customer.comment, customer.street_address_1, customer.street_address_2, customer.country_id, customer.state_id, customer.city, customer.post_code, customer.phone, customer.phone_mobile, customer.email, customer.prism, customer.extras, customer.created, customer.updated, customer.deleted, customer.update_user_id
  • Hash Cond: (cd.customer_id = customer.id)
  • Buffers: shared hit=4459
7. 155.038 943.599 ↓ 8.3 25,387 1

HashAggregate (cost=5,202.79..5,233.39 rows=3,060 width=56) (actual time=866.491..943.599 rows=25,387 loops=1)

  • Output: ((((((COALESCE(cd.id, 0))::text || '-'::text) || (COALESCE(cd.customer_id, 0))::text) || '-'::text) || (COALESCE(cd.device_id, 0))::text)), cd.customer_id, cd.device_id, (lower(cd.duration)), (upper(cd.duration))
  • Group Key: ((((((COALESCE(cd.id, 0))::text || '-'::text) || (COALESCE(cd.customer_id, 0))::text) || '-'::text) || (COALESCE(cd.device_id, 0))::text)), cd.customer_id, cd.device_id, (lower(cd.duration)), (upper(cd.duration))
  • Buffers: shared hit=3267
8. 122.652 788.561 ↓ 8.3 25,387 1

Append (cost=2,736.98..5,164.54 rows=3,060 width=56) (actual time=423.689..788.561 rows=25,387 loops=1)

  • Buffers: shared hit=3267
9. 161.826 665.852 ↓ 8.3 25,387 1

Hash Join (cost=2,736.98..5,133.86 rows=3,058 width=56) (actual time=423.683..665.852 rows=25,387 loops=1)

  • Output: (((((COALESCE(cd.id, 0))::text || '-'::text) || (COALESCE(cd.customer_id, 0))::text) || '-'::text) || (COALESCE(cd.device_id, 0))::text), cd.customer_id, cd.device_id, lower(cd.duration), upper(cd.duration)
  • Hash Cond: (d.id = cd.device_id)
  • Buffers: shared hit=3267
10. 80.479 80.479 ↑ 1.0 26,831 1

Seq Scan on public.device d (cost=0.00..2,073.32 rows=26,831 width=4) (actual time=0.054..80.479 rows=26,831 loops=1)

  • Output: d.id
  • Filter: (d.deleted IS NULL)
  • Rows Removed by Filter: 601
  • Buffers: shared hit=1799
11. 69.275 423.547 ↓ 8.1 25,387 1

Hash (cost=2,697.91..2,697.91 rows=3,126 width=26) (actual time=423.547..423.547 rows=25,387 loops=1)

  • Output: cd.id, cd.customer_id, cd.device_id, cd.duration
  • Buckets: 32768 (originally 4096) Batches: 1 (originally 1) Memory Usage: 1697kB
  • Buffers: shared hit=1468
12. 138.547 354.272 ↓ 8.1 25,387 1

Hash Join (cost=1,000.74..2,697.91 rows=3,126 width=26) (actual time=147.116..354.272 rows=25,387 loops=1)

  • Output: cd.id, cd.customer_id, cd.device_id, cd.duration
  • Hash Cond: (c.id = cd.customer_id)
  • Buffers: shared hit=1468
13. 68.655 68.655 ↑ 1.0 25,238 1

Seq Scan on public.customer c (cost=0.00..1,445.08 rows=25,238 width=4) (actual time=0.008..68.655 rows=25,238 loops=1)

  • Output: c.id
  • Filter: (c.deleted IS NULL)
  • Rows Removed by Filter: 70
  • Buffers: shared hit=1192
14. 68.142 147.070 ↓ 8.1 25,387 1

Hash (cost=961.55..961.55 rows=3,135 width=26) (actual time=147.070..147.070 rows=25,387 loops=1)

  • Output: cd.id, cd.customer_id, cd.device_id, cd.duration
  • Buckets: 32768 (originally 4096) Batches: 1 (originally 1) Memory Usage: 1697kB
  • Buffers: shared hit=276
15. 78.928 78.928 ↓ 8.1 25,387 1

Seq Scan on public.customer_device cd (cost=0.00..961.55 rows=3,135 width=26) (actual time=0.104..78.928 rows=25,387 loops=1)

  • Output: cd.id, cd.customer_id, cd.device_id, cd.duration
  • Filter: ((cd.customer_id IS NOT NULL) AND (cd.device_id IS NOT NULL) AND ((lower(cd.duration) <= '2020-05-13 14:00:00+00'::timestamp with time zone) OR (lower(cd.duration) IS NULL)) AND ((upper(cd.duration) >= '2020-04-12 14:00:00+00'::timestamp with time zone) OR (upper(cd.duration) IS NULL)))
  • Rows Removed by Filter: 2275
  • Buffers: shared hit=276
16. 0.006 0.057 ↓ 0.0 0 1

Subquery Scan on customer_device_unassigned (cost=0.01..0.08 rows=2 width=56) (actual time=0.057..0.057 rows=0 loops=1)

  • Output: ((('0-'::text || (COALESCE(customer_device_unassigned.customer_id, 0))::text) || '-'::text) || (COALESCE(customer_device_unassigned.device_id, 0))::text), customer_device_unassigned.customer_id, customer_device_unassigned.device_id, NULL::timestamp with time zone, NULL::timestamp with time zone
17. 0.005 0.051 ↓ 0.0 0 1

Unique (cost=0.01..0.03 rows=2 width=8) (actual time=0.051..0.051 rows=0 loops=1)

  • Output: id, (NULL::integer)
18. 0.033 0.046 ↓ 0.0 0 1

Sort (cost=0.01..0.02 rows=2 width=8) (actual time=0.046..0.046 rows=0 loops=1)

  • Output: id, (NULL::integer)
  • Sort Key: id, (NULL::integer)
  • Sort Method: quicksort Memory: 25kB
19. 0.008 0.013 ↓ 0.0 0 1

Append (cost=0.00..0.00 rows=2 width=8) (actual time=0.013..0.013 rows=0 loops=1)

20. 0.003 0.003 ↓ 0.0 0 1

Result (cost=0.00..0.00 rows=0 width=8) (actual time=0.003..0.003 rows=0 loops=1)

  • Output: id, NULL::integer
  • One-Time Filter: false
21. 0.002 0.002 ↓ 0.0 0 1

Result (cost=0.00..0.00 rows=0 width=8) (actual time=0.002..0.002 rows=0 loops=1)

  • Output: NULL::integer, id
  • One-Time Filter: false
22. 76.877 159.531 ↑ 1.0 25,238 1

Hash (cost=1,508.35..1,508.35 rows=25,238 width=3,294) (actual time=159.531..159.531 rows=25,238 loops=1)

  • Output: customer.id, customer.entity_id, customer.reference, customer.name, customer.phonetic_name, customer.contact_1, customer.contact_2, customer.contact_3, customer.comment, customer.street_address_1, customer.street_address_2, customer.country_id, customer.state_id, customer.city, customer.post_code, customer.phone, customer.phone_mobile, customer.email, customer.prism, customer.extras, customer.created, customer.updated, customer.deleted, customer.update_user_id
  • Buckets: 32768 Batches: 1 Memory Usage: 5571kB
  • Buffers: shared hit=1192
23. 82.654 82.654 ↑ 1.0 25,238 1

Seq Scan on public.customer (cost=0.00..1,508.35 rows=25,238 width=3,294) (actual time=0.026..82.654 rows=25,238 loops=1)

  • Output: customer.id, customer.entity_id, customer.reference, customer.name, customer.phonetic_name, customer.contact_1, customer.contact_2, customer.contact_3, customer.comment, customer.street_address_1, customer.street_address_2, customer.country_id, customer.state_id, customer.city, customer.post_code, customer.phone, customer.phone_mobile, customer.email, customer.prism, customer.extras, customer.created, customer.updated, customer.deleted, customer.update_user_id
  • Filter: ((customer.deleted IS NULL) AND (customer.entity_id = 1))
  • Rows Removed by Filter: 70
  • Buffers: shared hit=1192
24. 203.096 203.096 ↑ 1.0 1 25,387

Index Scan using device_pkey on public.device (cost=0.29..1.06 rows=1 width=228) (actual time=0.006..0.008 rows=1 loops=25,387)

  • Output: device.id, device.active, device.eid, device.entity_id, device.address_id, device.device_type_id, device.device_group_id, device.parent_id, device.communication_status_id, device.last_seen, device.created, device.updated, device.deleted, device.update_user_id, device.installed, device.application_profile_id, device.serial, device.radio_id, device.first_seen
  • Index Cond: (device.id = cd.device_id)
  • Filter: ((device.deleted IS NULL) AND (device.entity_id = 1) AND (device.device_type_id = ANY ('{2549,2,527,538,599,742,541,528,543,621,622,623,708,539,637,638,816,1107,1108,1242,1243,1267,1447,1448,1449,540,1453,872,873,874,875,876,877,878,879,880,881,882,883,884,2578,3829}'::integer[])))
  • Buffers: shared hit=76484
25. 203.096 203.096 ↑ 1.0 1 25,387

Index Scan using address_pkey on public.address (cost=0.29..0.37 rows=1 width=216) (actual time=0.005..0.008 rows=1 loops=25,387)

  • Output: address.id, address.street_address_1, address.street_address_2, address.country_id, address.state_id, address.city, address.post_code, address.gps_lat, address.gps_lng, address.created, address.updated, address.deleted, address.update_user_id, address.geom
  • Index Cond: (address.id = device.address_id)
  • Buffers: shared hit=76399
26.          

SubPlan (for Result)

27. 0.873 5,922.820 ↑ 1.0 1 97

Limit (cost=23.72..24.00 rows=1 width=40) (actual time=61.057..61.060 rows=1 loops=97)

  • Output: (CASE WHEN (drh.calculated IS NOT NULL) THEN drh.calculated_value ELSE (CASE WHEN ((rm.attributes ->> 'calculation'::text) IS NOT NULL) THEN get_device_resource_calculated(drh.device_id, rm.attributes, drh.value, drh.updated) ELSE ((drh.value)::text)::numeric END * COALESCE(((rm.attributes ->> 'scale'::text))::numeric, '1'::numeric)) END), drh.updated
  • Buffers: shared hit=540918
28. 0.970 5,921.947 ↑ 1.0 1 97

Result (cost=23.72..24.00 rows=1 width=40) (actual time=61.051..61.051 rows=1 loops=97)

  • Output: CASE WHEN (drh.calculated IS NOT NULL) THEN drh.calculated_value ELSE (CASE WHEN ((rm.attributes ->> 'calculation'::text) IS NOT NULL) THEN get_device_resource_calculated(drh.device_id, rm.attributes, drh.value, drh.updated) ELSE ((drh.value)::text)::numeric END * COALESCE(((rm.attributes ->> 'scale'::text))::numeric, '1'::numeric)) END, drh.updated
  • Buffers: shared hit=540918
29. 188.568 5,920.977 ↑ 1.0 1 97

Sort (cost=23.72..23.72 rows=1 width=204) (actual time=61.041..61.041 rows=1 loops=97)

  • Output: drh.updated, drh.calculated, drh.calculated_value, rm.attributes, drh.device_id, drh.value
  • Sort Key: drh.updated
  • Sort Method: top-N heapsort Memory: 25kB
  • Buffers: shared hit=540918
30. 641.553 5,732.409 ↓ 704.0 704 97

Nested Loop (cost=7.30..23.71 rows=1 width=204) (actual time=0.193..59.097 rows=704 loops=97)

  • Output: drh.updated, drh.calculated, drh.calculated_value, rm.attributes, drh.device_id, drh.value
  • Buffers: shared hit=540856
31. 663.572 4,681.026 ↓ 704.0 704 97

Nested Loop (cost=7.16..23.46 rows=1 width=208) (actual time=0.179..48.258 rows=704 loops=97)

  • Output: drh.calculated, drh.calculated_value, drh.device_id, drh.value, drh.updated, rm.attributes, rg.resource_group_meta_id
  • Buffers: shared hit=472550
32. 670.750 3,607.624 ↓ 704.0 704 97

Nested Loop (cost=7.02..23.26 rows=1 width=208) (actual time=0.165..37.192 rows=704 loops=97)

  • Output: drh.calculated, drh.calculated_value, drh.device_id, drh.value, drh.updated, r.resource_group_id, rm.attributes
  • Buffers: shared hit=335940
33. 333.971 2,527.044 ↓ 704.0 704 97

Nested Loop (cost=6.88..22.82 rows=1 width=58) (actual time=0.150..26.052 rows=704 loops=97)

  • Output: drh.calculated, drh.calculated_value, drh.device_id, drh.value, drh.updated, r.resource_meta_id, r.resource_group_id
  • Buffers: shared hit=199330
34. 2.231 6.693 ↑ 1.0 1 97

Merge Join (cost=2.72..2.85 rows=1 width=4) (actual time=0.053..0.069 rows=1 loops=97)

  • Output: d_1.id
  • Merge Cond: (d_1.device_type_id = dt.id)
  • Buffers: shared hit=390
35. 1.455 3.007 ↑ 1.0 1 97

Sort (cost=2.52..2.52 rows=1 width=8) (actual time=0.028..0.031 rows=1 loops=97)

  • Output: d_1.id, d_1.device_type_id
  • Sort Key: d_1.device_type_id
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=292
36. 1.552 1.552 ↑ 1.0 1 97

Index Scan using device_pkey on public.device d_1 (cost=0.29..2.51 rows=1 width=8) (actual time=0.013..0.016 rows=1 loops=97)

  • Output: d_1.id, d_1.device_type_id
  • Index Cond: (d_1.id = cd.device_id)
  • Buffers: shared hit=292
37. 1.455 1.455 ↑ 17.0 3 97

Index Only Scan using device_type_pkey on public.device_type dt (cost=0.14..3.10 rows=51 width=4) (actual time=0.008..0.015 rows=3 loops=97)

  • Output: dt.id
  • Heap Fetches: 0
  • Buffers: shared hit=98
38. 681.905 2,186.380 ↓ 704.0 704 97

Nested Loop (cost=4.16..19.96 rows=1 width=58) (actual time=0.085..22.540 rows=704 loops=97)

  • Output: drh.calculated, drh.calculated_value, drh.device_id, drh.value, drh.updated, r.resource_meta_id, r.resource_group_id
  • Join Filter: (drh.resource_id = r.id)
  • Buffers: shared hit=198940
39. 350.472 1,094.645 ↓ 117.3 704 97

Hash Join (cost=4.02..17.37 rows=6 width=58) (actual time=0.070..11.285 rows=704 loops=97)

  • Output: drh.calculated, drh.calculated_value, drh.device_id, drh.value, drh.updated, drh.resource_id, u0.primary_resource_id
  • Hash Cond: (drh.resource_id = u0.primary_resource_id)
  • Buffers: shared hit=62330
40. 335.814 743.796 ↓ 118.0 708 97

Append (cost=0.00..13.27 rows=6 width=55) (actual time=0.056..7.668 rows=708 loops=97)

  • Buffers: shared hit=62327
41. 0.291 0.291 ↓ 0.0 0 97

Seq Scan on public.device_resource_history drh (cost=0.00..0.00 rows=1 width=88) (actual time=0.003..0.003 rows=0 loops=97)

  • Output: drh.calculated, drh.calculated_value, drh.device_id, drh.value, drh.updated, drh.resource_id
  • Filter: ((drh.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh.updated >= (lower(cd.duration))) AND (drh.device_id = cd.device_id))
42. 45.784 45.784 ↓ 76.0 76 97

Index Scan using _hyper_6_159_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_159_chunk drh_1 (cost=0.43..2.65 rows=1 width=48) (actual time=0.036..0.472 rows=76 loops=97)

  • Output: drh_1.calculated, drh_1.calculated_value, drh_1.device_id, drh_1.value, drh_1.updated, drh_1.resource_id
  • Index Cond: ((drh_1.device_id = cd.device_id) AND (drh_1.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_1.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_1.updated >= (lower(cd.duration))))
  • Buffers: shared hit=6859
43. 89.337 89.337 ↓ 156.0 156 97

Index Scan using _hyper_6_161_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_161_chunk drh_2 (cost=0.43..2.65 rows=1 width=48) (actual time=0.023..0.921 rows=156 loops=97)

  • Output: drh_2.calculated, drh_2.calculated_value, drh_2.device_id, drh_2.value, drh_2.updated, drh_2.resource_id
  • Index Cond: ((drh_2.device_id = cd.device_id) AND (drh_2.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_2.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_2.updated >= (lower(cd.duration))))
  • Buffers: shared hit=13571
44. 91.859 91.859 ↓ 160.0 160 97

Index Scan using _hyper_6_162_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_162_chunk drh_3 (cost=0.43..2.65 rows=1 width=48) (actual time=0.022..0.947 rows=160 loops=97)

  • Output: drh_3.calculated, drh_3.calculated_value, drh_3.device_id, drh_3.value, drh_3.updated, drh_3.resource_id
  • Index Cond: ((drh_3.device_id = cd.device_id) AND (drh_3.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_3.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_3.updated >= (lower(cd.duration))))
  • Buffers: shared hit=13922
45. 93.217 93.217 ↓ 163.0 163 97

Index Scan using _hyper_6_163_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_163_chunk drh_4 (cost=0.43..2.65 rows=1 width=48) (actual time=0.022..0.961 rows=163 loops=97)

  • Output: drh_4.calculated, drh_4.calculated_value, drh_4.device_id, drh_4.value, drh_4.updated, drh_4.resource_id
  • Index Cond: ((drh_4.device_id = cd.device_id) AND (drh_4.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_4.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_4.updated >= (lower(cd.duration))))
  • Buffers: shared hit=14371
46. 87.494 87.494 ↓ 153.0 153 97

Index Scan using _hyper_6_164_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_164_chunk drh_5 (cost=0.43..2.65 rows=1 width=48) (actual time=0.022..0.902 rows=153 loops=97)

  • Output: drh_5.calculated, drh_5.calculated_value, drh_5.device_id, drh_5.value, drh_5.updated, drh_5.resource_id
  • Index Cond: ((drh_5.device_id = cd.device_id) AND (drh_5.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_5.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_5.updated >= (lower(cd.duration))))
  • Buffers: shared hit=13604
47. 0.054 0.377 ↑ 1.0 17 1

Hash (cost=3.81..3.81 rows=17 width=4) (actual time=0.377..0.377 rows=17 loops=1)

  • Output: u0.primary_resource_id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=3
48. 0.173 0.323 ↓ 1.1 18 1

HashAggregate (cost=3.64..3.81 rows=17 width=4) (actual time=0.281..0.323 rows=18 loops=1)

  • Output: u0.primary_resource_id
  • Group Key: u0.primary_resource_id
  • Buffers: shared hit=3
49. 0.150 0.150 ↑ 1.0 51 1

Seq Scan on public.device_type u0 (cost=0.00..3.51 rows=51 width=4) (actual time=0.008..0.150 rows=51 loops=1)

  • Output: u0.primary_resource_id
  • Buffers: shared hit=3
50. 409.830 409.830 ↑ 1.0 1 68,305

Index Scan using resource_pkey on public.resource r (cost=0.14..0.42 rows=1 width=12) (actual time=0.003..0.006 rows=1 loops=68,305)

  • Output: r.id, r.resource_meta_id, r.resource_group_id, r.measurement, r.field_name, r.created, r.updated, r.deleted
  • Index Cond: (r.id = u0.primary_resource_id)
  • Buffers: shared hit=136610
51. 409.830 409.830 ↑ 1.0 1 68,305

Index Scan using resource_meta_pkey on public.resource_meta rm (cost=0.14..0.43 rows=1 width=158) (actual time=0.003..0.006 rows=1 loops=68,305)

  • Output: rm.id, rm.resource_group_meta_id, rm.code, rm.description, rm.value_type, rm.unit_of_measure, rm.attributes, rm.created, rm.updated, rm.deleted
  • Index Cond: (rm.id = r.resource_meta_id)
  • Buffers: shared hit=136610
52. 409.830 409.830 ↑ 1.0 1 68,305

Index Scan using resource_group_pkey on public.resource_group rg (cost=0.14..0.19 rows=1 width=8) (actual time=0.003..0.006 rows=1 loops=68,305)

  • Output: rg.id, rg.resource_group_meta_id, rg.code, rg.description, rg.created, rg.updated, rg.deleted
  • Index Cond: (rg.id = r.resource_group_id)
  • Buffers: shared hit=136610
53. 409.830 409.830 ↑ 1.0 1 68,305

Index Only Scan using resource_group_meta_pkey on public.resource_group_meta rgm (cost=0.14..0.23 rows=1 width=4) (actual time=0.003..0.006 rows=1 loops=68,305)

  • Output: rgm.id
  • Index Cond: (rgm.id = rg.resource_group_meta_id)
  • Heap Fetches: 0
  • Buffers: shared hit=68306
54. 0.021 48.651 ↑ 1.0 1 3

Limit (cost=23.73..24.02 rows=1 width=40) (actual time=16.215..16.217 rows=1 loops=3)

  • Output: (CASE WHEN (drh_6.calculated IS NOT NULL) THEN drh_6.calculated_value ELSE (CASE WHEN ((rm_1.attributes ->> 'calculation'::text) IS NOT NULL) THEN get_device_resource_calculated(drh_6.device_id, rm_1.attributes, drh_6.value, drh_6.updated) ELSE ((drh_6.value)::text)::numeric END * COALESCE(((rm_1.attributes ->> 'scale'::text))::numeric, '1'::numeric)) END), drh_6.updated
  • Buffers: shared hit=4570
55. 0.027 48.630 ↑ 1.0 1 3

Result (cost=23.73..24.02 rows=1 width=40) (actual time=16.210..16.210 rows=1 loops=3)

  • Output: CASE WHEN (drh_6.calculated IS NOT NULL) THEN drh_6.calculated_value ELSE (CASE WHEN ((rm_1.attributes ->> 'calculation'::text) IS NOT NULL) THEN get_device_resource_calculated(drh_6.device_id, rm_1.attributes, drh_6.value, drh_6.updated) ELSE ((drh_6.value)::text)::numeric END * COALESCE(((rm_1.attributes ->> 'scale'::text))::numeric, '1'::numeric)) END, drh_6.updated
  • Buffers: shared hit=4570
56. 1.530 48.603 ↑ 1.0 1 3

Sort (cost=23.73..23.73 rows=1 width=204) (actual time=16.201..16.201 rows=1 loops=3)

  • Output: drh_6.updated, drh_6.calculated, drh_6.calculated_value, rm_1.attributes, drh_6.device_id, drh_6.value
  • Sort Key: drh_6.updated
  • Sort Method: top-N heapsort Memory: 25kB
  • Buffers: shared hit=4570
57. 5.675 47.073 ↓ 190.0 190 3

Nested Loop (cost=7.30..23.72 rows=1 width=204) (actual time=0.338..15.691 rows=190 loops=3)

  • Output: drh_6.updated, drh_6.calculated, drh_6.calculated_value, rm_1.attributes, drh_6.device_id, drh_6.value
  • Buffers: shared hit=4570
58. 5.289 38.553 ↓ 190.0 190 3

Nested Loop (cost=7.16..23.48 rows=1 width=208) (actual time=0.321..12.851 rows=190 loops=3)

  • Output: drh_6.calculated, drh_6.calculated_value, drh_6.device_id, drh_6.value, drh_6.updated, rm_1.attributes, rg_1.resource_group_meta_id
  • Buffers: shared hit=4000
59. 5.316 29.850 ↓ 190.0 190 3

Nested Loop (cost=7.02..23.28 rows=1 width=208) (actual time=0.309..9.950 rows=190 loops=3)

  • Output: drh_6.calculated, drh_6.calculated_value, drh_6.device_id, drh_6.value, drh_6.updated, r_1.resource_group_id, rm_1.attributes
  • Buffers: shared hit=2862
60. 2.730 21.120 ↓ 190.0 190 3

Nested Loop (cost=6.88..22.83 rows=1 width=58) (actual time=0.298..7.040 rows=190 loops=3)

  • Output: drh_6.calculated, drh_6.calculated_value, drh_6.device_id, drh_6.value, drh_6.updated, r_1.resource_meta_id, r_1.resource_group_id
  • Buffers: shared hit=1724
61. 0.060 0.192 ↑ 1.0 1 3

Merge Join (cost=2.72..2.85 rows=1 width=4) (actual time=0.051..0.064 rows=1 loops=3)

  • Output: d_2.id
  • Merge Cond: (d_2.device_type_id = dt_1.id)
  • Buffers: shared hit=13
62. 0.051 0.093 ↑ 1.0 1 3

Sort (cost=2.52..2.52 rows=1 width=8) (actual time=0.028..0.031 rows=1 loops=3)

  • Output: d_2.id, d_2.device_type_id
  • Sort Key: d_2.device_type_id
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=9
63. 0.042 0.042 ↑ 1.0 1 3

Index Scan using device_pkey on public.device d_2 (cost=0.29..2.51 rows=1 width=8) (actual time=0.011..0.014 rows=1 loops=3)

  • Output: d_2.id, d_2.device_type_id
  • Index Cond: (d_2.id = cd.device_id)
  • Buffers: shared hit=9
64. 0.039 0.039 ↑ 17.0 3 3

Index Only Scan using device_type_pkey on public.device_type dt_1 (cost=0.14..3.10 rows=51 width=4) (actual time=0.008..0.013 rows=3 loops=3)

  • Output: dt_1.id
  • Heap Fetches: 0
  • Buffers: shared hit=4
65. 5.322 18.198 ↓ 190.0 190 3

Nested Loop (cost=4.16..19.97 rows=1 width=58) (actual time=0.232..6.066 rows=190 loops=3)

  • Output: drh_6.calculated, drh_6.calculated_value, drh_6.device_id, drh_6.value, drh_6.updated, r_1.resource_meta_id, r_1.resource_group_id
  • Join Filter: (drh_6.resource_id = r_1.id)
  • Buffers: shared hit=1711
66. 2.804 9.462 ↓ 31.7 190 3

Hash Join (cost=4.02..17.38 rows=6 width=58) (actual time=0.218..3.154 rows=190 loops=3)

  • Output: drh_6.calculated, drh_6.calculated_value, drh_6.device_id, drh_6.value, drh_6.updated, drh_6.resource_id, u0_1.primary_resource_id
  • Hash Cond: (drh_6.resource_id = u0_1.primary_resource_id)
  • Buffers: shared hit=573
67. 2.760 6.270 ↓ 31.8 191 3

Append (cost=0.00..13.29 rows=6 width=55) (actual time=0.073..2.090 rows=191 loops=3)

  • Buffers: shared hit=570
68. 0.012 0.012 ↓ 0.0 0 3

Seq Scan on public.device_resource_history drh_6 (cost=0.00..0.00 rows=1 width=88) (actual time=0.004..0.004 rows=0 loops=3)

  • Output: drh_6.calculated, drh_6.calculated_value, drh_6.device_id, drh_6.value, drh_6.updated, drh_6.resource_id
  • Filter: ((drh_6.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_6.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_6.updated >= (lower(cd.duration))) AND (drh_6.updated <= (upper(cd.duration))) AND (drh_6.device_id = cd.device_id))
69. 0.987 0.987 ↓ 55.0 55 3

Index Scan using _hyper_6_159_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_159_chunk drh_7 (cost=0.43..2.66 rows=1 width=48) (actual time=0.027..0.329 rows=55 loops=3)

  • Output: drh_7.calculated, drh_7.calculated_value, drh_7.device_id, drh_7.value, drh_7.updated, drh_7.resource_id
  • Index Cond: ((drh_7.device_id = cd.device_id) AND (drh_7.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_7.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_7.updated >= (lower(cd.duration))) AND (drh_7.updated <= (upper(cd.duration))))
  • Buffers: shared hit=157
70. 1.905 1.905 ↓ 111.0 111 3

Index Scan using _hyper_6_161_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_161_chunk drh_8 (cost=0.43..2.66 rows=1 width=48) (actual time=0.022..0.635 rows=111 loops=3)

  • Output: drh_8.calculated, drh_8.calculated_value, drh_8.device_id, drh_8.value, drh_8.updated, drh_8.resource_id
  • Index Cond: ((drh_8.device_id = cd.device_id) AND (drh_8.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_8.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_8.updated >= (lower(cd.duration))) AND (drh_8.updated <= (upper(cd.duration))))
  • Buffers: shared hit=310
71. 0.525 0.525 ↓ 25.0 25 3

Index Scan using _hyper_6_162_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_162_chunk drh_9 (cost=0.43..2.66 rows=1 width=48) (actual time=0.018..0.175 rows=25 loops=3)

  • Output: drh_9.calculated, drh_9.calculated_value, drh_9.device_id, drh_9.value, drh_9.updated, drh_9.resource_id
  • Index Cond: ((drh_9.device_id = cd.device_id) AND (drh_9.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_9.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_9.updated >= (lower(cd.duration))) AND (drh_9.updated <= (upper(cd.duration))))
  • Buffers: shared hit=85
72. 0.042 0.042 ↓ 0.0 0 3

Index Scan using _hyper_6_163_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_163_chunk drh_10 (cost=0.43..2.66 rows=1 width=48) (actual time=0.014..0.014 rows=0 loops=3)

  • Output: drh_10.calculated, drh_10.calculated_value, drh_10.device_id, drh_10.value, drh_10.updated, drh_10.resource_id
  • Index Cond: ((drh_10.device_id = cd.device_id) AND (drh_10.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_10.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_10.updated >= (lower(cd.duration))) AND (drh_10.updated <= (upper(cd.duration))))
  • Buffers: shared hit=9
73. 0.039 0.039 ↓ 0.0 0 3

Index Scan using _hyper_6_164_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_164_chunk drh_11 (cost=0.43..2.66 rows=1 width=48) (actual time=0.013..0.013 rows=0 loops=3)

  • Output: drh_11.calculated, drh_11.calculated_value, drh_11.device_id, drh_11.value, drh_11.updated, drh_11.resource_id
  • Index Cond: ((drh_11.device_id = cd.device_id) AND (drh_11.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_11.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_11.updated >= (lower(cd.duration))) AND (drh_11.updated <= (upper(cd.duration))))
  • Buffers: shared hit=9
74. 0.050 0.388 ↑ 1.0 17 1

Hash (cost=3.81..3.81 rows=17 width=4) (actual time=0.388..0.388 rows=17 loops=1)

  • Output: u0_1.primary_resource_id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=3
75. 0.184 0.338 ↓ 1.1 18 1

HashAggregate (cost=3.64..3.81 rows=17 width=4) (actual time=0.295..0.338 rows=18 loops=1)

  • Output: u0_1.primary_resource_id
  • Group Key: u0_1.primary_resource_id
  • Buffers: shared hit=3
76. 0.154 0.154 ↑ 1.0 51 1

Seq Scan on public.device_type u0_1 (cost=0.00..3.51 rows=51 width=4) (actual time=0.010..0.154 rows=51 loops=1)

  • Output: u0_1.primary_resource_id
  • Buffers: shared hit=3
77. 3.414 3.414 ↑ 1.0 1 569

Index Scan using resource_pkey on public.resource r_1 (cost=0.14..0.42 rows=1 width=12) (actual time=0.003..0.006 rows=1 loops=569)

  • Output: r_1.id, r_1.resource_meta_id, r_1.resource_group_id, r_1.measurement, r_1.field_name, r_1.created, r_1.updated, r_1.deleted
  • Index Cond: (r_1.id = u0_1.primary_resource_id)
  • Buffers: shared hit=1138
78. 3.414 3.414 ↑ 1.0 1 569

Index Scan using resource_meta_pkey on public.resource_meta rm_1 (cost=0.14..0.43 rows=1 width=158) (actual time=0.003..0.006 rows=1 loops=569)

  • Output: rm_1.id, rm_1.resource_group_meta_id, rm_1.code, rm_1.description, rm_1.value_type, rm_1.unit_of_measure, rm_1.attributes, rm_1.created, rm_1.updated, rm_1.deleted
  • Index Cond: (rm_1.id = r_1.resource_meta_id)
  • Buffers: shared hit=1138
79. 3.414 3.414 ↑ 1.0 1 569

Index Scan using resource_group_pkey on public.resource_group rg_1 (cost=0.14..0.19 rows=1 width=8) (actual time=0.003..0.006 rows=1 loops=569)

  • Output: rg_1.id, rg_1.resource_group_meta_id, rg_1.code, rg_1.description, rg_1.created, rg_1.updated, rg_1.deleted
  • Index Cond: (rg_1.id = r_1.resource_group_id)
  • Buffers: shared hit=1138
80. 2.845 2.845 ↑ 1.0 1 569

Index Only Scan using resource_group_meta_pkey on public.resource_group_meta rgm_1 (cost=0.14..0.23 rows=1 width=4) (actual time=0.003..0.005 rows=1 loops=569)

  • Output: rgm_1.id
  • Index Cond: (rgm_1.id = rg_1.resource_group_meta_id)
  • Heap Fetches: 0
  • Buffers: shared hit=570
81. 0.873 5,767.523 ↑ 1.0 1 97

Limit (cost=23.72..24.00 rows=1 width=40) (actual time=59.456..59.459 rows=1 loops=97)

  • Output: (CASE WHEN (drh_12.calculated IS NOT NULL) THEN drh_12.calculated_value ELSE (CASE WHEN ((rm_2.attributes ->> 'calculation'::text) IS NOT NULL) THEN get_device_resource_calculated(drh_12.device_id, rm_2.attributes, drh_12.value, drh_12.updated) ELSE ((drh_12.value)::text)::numeric END * COALESCE(((rm_2.attributes ->> 'scale'::text))::numeric, '1'::numeric)) END), drh_12.updated
  • Buffers: shared hit=541652
82. 0.970 5,766.650 ↑ 1.0 1 97

Result (cost=23.72..24.00 rows=1 width=40) (actual time=59.450..59.450 rows=1 loops=97)

  • Output: CASE WHEN (drh_12.calculated IS NOT NULL) THEN drh_12.calculated_value ELSE (CASE WHEN ((rm_2.attributes ->> 'calculation'::text) IS NOT NULL) THEN get_device_resource_calculated(drh_12.device_id, rm_2.attributes, drh_12.value, drh_12.updated) ELSE ((drh_12.value)::text)::numeric END * COALESCE(((rm_2.attributes ->> 'scale'::text))::numeric, '1'::numeric)) END, drh_12.updated
  • Buffers: shared hit=541652
83. 186.531 5,765.680 ↑ 1.0 1 97

Sort (cost=23.72..23.72 rows=1 width=204) (actual time=59.440..59.440 rows=1 loops=97)

  • Output: drh_12.updated, drh_12.calculated, drh_12.calculated_value, rm_2.attributes, drh_12.device_id, drh_12.value
  • Sort Key: drh_12.updated DESC
  • Sort Method: top-N heapsort Memory: 25kB
  • Buffers: shared hit=541652
84. 640.874 5,579.149 ↓ 704.0 704 97

Nested Loop (cost=7.30..23.71 rows=1 width=204) (actual time=0.173..57.517 rows=704 loops=97)

  • Output: drh_12.updated, drh_12.calculated, drh_12.calculated_value, rm_2.attributes, drh_12.device_id, drh_12.value
  • Buffers: shared hit=541652
85. 664.154 4,528.445 ↓ 704.0 704 97

Nested Loop (cost=7.16..23.46 rows=1 width=208) (actual time=0.160..46.685 rows=704 loops=97)

  • Output: drh_12.calculated, drh_12.calculated_value, drh_12.device_id, drh_12.value, drh_12.updated, rm_2.attributes, rg_2.resource_group_meta_id
  • Buffers: shared hit=473346
86. 670.265 3,454.461 ↓ 704.0 704 97

Nested Loop (cost=7.02..23.26 rows=1 width=208) (actual time=0.143..35.613 rows=704 loops=97)

  • Output: drh_12.calculated, drh_12.calculated_value, drh_12.device_id, drh_12.value, drh_12.updated, r_2.resource_group_id, rm_2.attributes
  • Buffers: shared hit=336736
87. 330.964 2,374.366 ↓ 704.0 704 97

Nested Loop (cost=6.88..22.82 rows=1 width=58) (actual time=0.129..24.478 rows=704 loops=97)

  • Output: drh_12.calculated, drh_12.calculated_value, drh_12.device_id, drh_12.value, drh_12.updated, r_2.resource_meta_id, r_2.resource_group_id
  • Buffers: shared hit=200126
88. 2.037 6.208 ↑ 1.0 1 97

Merge Join (cost=2.72..2.85 rows=1 width=4) (actual time=0.049..0.064 rows=1 loops=97)

  • Output: d_3.id
  • Merge Cond: (d_3.device_type_id = dt_2.id)
  • Buffers: shared hit=389
89. 1.455 2.813 ↑ 1.0 1 97

Sort (cost=2.52..2.52 rows=1 width=8) (actual time=0.025..0.029 rows=1 loops=97)

  • Output: d_3.id, d_3.device_type_id
  • Sort Key: d_3.device_type_id
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=291
90. 1.358 1.358 ↑ 1.0 1 97

Index Scan using device_pkey on public.device d_3 (cost=0.29..2.51 rows=1 width=8) (actual time=0.011..0.014 rows=1 loops=97)

  • Output: d_3.id, d_3.device_type_id
  • Index Cond: (d_3.id = cd.device_id)
  • Buffers: shared hit=291
91. 1.358 1.358 ↑ 17.0 3 97

Index Only Scan using device_type_pkey on public.device_type dt_2 (cost=0.14..3.10 rows=51 width=4) (actual time=0.008..0.014 rows=3 loops=97)

  • Output: dt_2.id
  • Heap Fetches: 0
  • Buffers: shared hit=98
92. 672.593 2,037.194 ↓ 704.0 704 97

Nested Loop (cost=4.16..19.96 rows=1 width=58) (actual time=0.068..21.002 rows=704 loops=97)

  • Output: drh_12.calculated, drh_12.calculated_value, drh_12.device_id, drh_12.value, drh_12.updated, r_2.resource_meta_id, r_2.resource_group_id
  • Join Filter: (drh_12.resource_id = r_2.id)
  • Buffers: shared hit=199737
93. 348.261 954.771 ↓ 117.3 704 97

Hash Join (cost=4.02..17.37 rows=6 width=58) (actual time=0.053..9.843 rows=704 loops=97)

  • Output: drh_12.calculated, drh_12.calculated_value, drh_12.device_id, drh_12.value, drh_12.updated, drh_12.resource_id, u0_2.primary_resource_id
  • Hash Cond: (drh_12.resource_id = u0_2.primary_resource_id)
  • Buffers: shared hit=63127
94. 333.001 606.153 ↓ 118.0 708 97

Append (cost=0.00..13.27 rows=6 width=55) (actual time=0.039..6.249 rows=708 loops=97)

  • Buffers: shared hit=63124
95. 0.291 0.291 ↓ 0.0 0 97

Seq Scan on public.device_resource_history drh_12 (cost=0.00..0.00 rows=1 width=88) (actual time=0.003..0.003 rows=0 loops=97)

  • Output: drh_12.calculated, drh_12.calculated_value, drh_12.device_id, drh_12.value, drh_12.updated, drh_12.resource_id
  • Filter: ((drh_12.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_12.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_12.updated >= (lower(cd.duration))) AND (drh_12.device_id = cd.device_id))
96. 30.555 30.555 ↓ 76.0 76 97

Index Scan Backward using _hyper_6_159_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_159_chunk drh_13 (cost=0.43..2.65 rows=1 width=48) (actual time=0.020..0.315 rows=76 loops=97)

  • Output: drh_13.calculated, drh_13.calculated_value, drh_13.device_id, drh_13.value, drh_13.updated, drh_13.resource_id
  • Index Cond: ((drh_13.device_id = cd.device_id) AND (drh_13.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_13.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_13.updated >= (lower(cd.duration))))
  • Buffers: shared hit=6956
97. 59.849 59.849 ↓ 156.0 156 97

Index Scan Backward using _hyper_6_161_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_161_chunk drh_14 (cost=0.43..2.65 rows=1 width=48) (actual time=0.021..0.617 rows=156 loops=97)

  • Output: drh_14.calculated, drh_14.calculated_value, drh_14.device_id, drh_14.value, drh_14.updated, drh_14.resource_id
  • Index Cond: ((drh_14.device_id = cd.device_id) AND (drh_14.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_14.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_14.updated >= (lower(cd.duration))))
  • Buffers: shared hit=13741
98. 61.401 61.401 ↓ 160.0 160 97

Index Scan Backward using _hyper_6_162_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_162_chunk drh_15 (cost=0.43..2.65 rows=1 width=48) (actual time=0.021..0.633 rows=160 loops=97)

  • Output: drh_15.calculated, drh_15.calculated_value, drh_15.device_id, drh_15.value, drh_15.updated, drh_15.resource_id
  • Index Cond: ((drh_15.device_id = cd.device_id) AND (drh_15.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_15.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_15.updated >= (lower(cd.duration))))
  • Buffers: shared hit=14099
99. 62.080 62.080 ↓ 163.0 163 97

Index Scan Backward using _hyper_6_163_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_163_chunk drh_16 (cost=0.43..2.65 rows=1 width=48) (actual time=0.021..0.640 rows=163 loops=97)

  • Output: drh_16.calculated, drh_16.calculated_value, drh_16.device_id, drh_16.value, drh_16.updated, drh_16.resource_id
  • Index Cond: ((drh_16.device_id = cd.device_id) AND (drh_16.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_16.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_16.updated >= (lower(cd.duration))))
  • Buffers: shared hit=14547
100. 58.976 58.976 ↓ 153.0 153 97

Index Scan Backward using _hyper_6_164_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_164_chunk drh_17 (cost=0.43..2.65 rows=1 width=48) (actual time=0.020..0.608 rows=153 loops=97)

  • Output: drh_17.calculated, drh_17.calculated_value, drh_17.device_id, drh_17.value, drh_17.updated, drh_17.resource_id
  • Index Cond: ((drh_17.device_id = cd.device_id) AND (drh_17.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_17.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_17.updated >= (lower(cd.duration))))
  • Buffers: shared hit=13781
101. 0.052 0.357 ↑ 1.0 17 1

Hash (cost=3.81..3.81 rows=17 width=4) (actual time=0.357..0.357 rows=17 loops=1)

  • Output: u0_2.primary_resource_id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=3
102. 0.174 0.305 ↓ 1.1 18 1

HashAggregate (cost=3.64..3.81 rows=17 width=4) (actual time=0.264..0.305 rows=18 loops=1)

  • Output: u0_2.primary_resource_id
  • Group Key: u0_2.primary_resource_id
  • Buffers: shared hit=3
103. 0.131 0.131 ↑ 1.0 51 1

Seq Scan on public.device_type u0_2 (cost=0.00..3.51 rows=51 width=4) (actual time=0.007..0.131 rows=51 loops=1)

  • Output: u0_2.primary_resource_id
  • Buffers: shared hit=3
104. 409.830 409.830 ↑ 1.0 1 68,305

Index Scan using resource_pkey on public.resource r_2 (cost=0.14..0.42 rows=1 width=12) (actual time=0.003..0.006 rows=1 loops=68,305)

  • Output: r_2.id, r_2.resource_meta_id, r_2.resource_group_id, r_2.measurement, r_2.field_name, r_2.created, r_2.updated, r_2.deleted
  • Index Cond: (r_2.id = u0_2.primary_resource_id)
  • Buffers: shared hit=136610
105. 409.830 409.830 ↑ 1.0 1 68,305

Index Scan using resource_meta_pkey on public.resource_meta rm_2 (cost=0.14..0.43 rows=1 width=158) (actual time=0.003..0.006 rows=1 loops=68,305)

  • Output: rm_2.id, rm_2.resource_group_meta_id, rm_2.code, rm_2.description, rm_2.value_type, rm_2.unit_of_measure, rm_2.attributes, rm_2.created, rm_2.updated, rm_2.deleted
  • Index Cond: (rm_2.id = r_2.resource_meta_id)
  • Buffers: shared hit=136610
106. 409.830 409.830 ↑ 1.0 1 68,305

Index Scan using resource_group_pkey on public.resource_group rg_2 (cost=0.14..0.19 rows=1 width=8) (actual time=0.003..0.006 rows=1 loops=68,305)

  • Output: rg_2.id, rg_2.resource_group_meta_id, rg_2.code, rg_2.description, rg_2.created, rg_2.updated, rg_2.deleted
  • Index Cond: (rg_2.id = r_2.resource_group_id)
  • Buffers: shared hit=136610
107. 409.830 409.830 ↑ 1.0 1 68,305

Index Only Scan using resource_group_meta_pkey on public.resource_group_meta rgm_2 (cost=0.14..0.23 rows=1 width=4) (actual time=0.003..0.006 rows=1 loops=68,305)

  • Output: rgm_2.id
  • Index Cond: (rgm_2.id = rg_2.resource_group_meta_id)
  • Heap Fetches: 0
  • Buffers: shared hit=68306
108. 0.021 47.556 ↑ 1.0 1 3

Limit (cost=23.73..24.02 rows=1 width=40) (actual time=15.850..15.852 rows=1 loops=3)

  • Output: (CASE WHEN (drh_18.calculated IS NOT NULL) THEN drh_18.calculated_value ELSE (CASE WHEN ((rm_3.attributes ->> 'calculation'::text) IS NOT NULL) THEN get_device_resource_calculated(drh_18.device_id, rm_3.attributes, drh_18.value, drh_18.updated) ELSE ((drh_18.value)::text)::numeric END * COALESCE(((rm_3.attributes ->> 'scale'::text))::numeric, '1'::numeric)) END), drh_18.updated
  • Buffers: shared hit=4577
109. 0.024 47.535 ↑ 1.0 1 3

Result (cost=23.73..24.02 rows=1 width=40) (actual time=15.845..15.845 rows=1 loops=3)

  • Output: CASE WHEN (drh_18.calculated IS NOT NULL) THEN drh_18.calculated_value ELSE (CASE WHEN ((rm_3.attributes ->> 'calculation'::text) IS NOT NULL) THEN get_device_resource_calculated(drh_18.device_id, rm_3.attributes, drh_18.value, drh_18.updated) ELSE ((drh_18.value)::text)::numeric END * COALESCE(((rm_3.attributes ->> 'scale'::text))::numeric, '1'::numeric)) END, drh_18.updated
  • Buffers: shared hit=4577
110. 1.527 47.511 ↑ 1.0 1 3

Sort (cost=23.73..23.73 rows=1 width=204) (actual time=15.837..15.837 rows=1 loops=3)

  • Output: drh_18.updated, drh_18.calculated, drh_18.calculated_value, rm_3.attributes, drh_18.device_id, drh_18.value
  • Sort Key: drh_18.updated DESC
  • Sort Method: top-N heapsort Memory: 25kB
  • Buffers: shared hit=4577
111. 5.642 45.984 ↓ 190.0 190 3

Nested Loop (cost=7.30..23.72 rows=1 width=204) (actual time=0.299..15.328 rows=190 loops=3)

  • Output: drh_18.updated, drh_18.calculated, drh_18.calculated_value, rm_3.attributes, drh_18.device_id, drh_18.value
  • Buffers: shared hit=4577
112. 5.460 37.497 ↓ 190.0 190 3

Nested Loop (cost=7.16..23.48 rows=1 width=208) (actual time=0.287..12.499 rows=190 loops=3)

  • Output: drh_18.calculated, drh_18.calculated_value, drh_18.device_id, drh_18.value, drh_18.updated, rm_3.attributes, rg_3.resource_group_meta_id
  • Buffers: shared hit=4007
113. 5.289 28.623 ↓ 190.0 190 3

Nested Loop (cost=7.02..23.28 rows=1 width=208) (actual time=0.275..9.541 rows=190 loops=3)

  • Output: drh_18.calculated, drh_18.calculated_value, drh_18.device_id, drh_18.value, drh_18.updated, r_3.resource_group_id, rm_3.attributes
  • Buffers: shared hit=2869
114. 2.703 19.920 ↓ 190.0 190 3

Nested Loop (cost=6.88..22.83 rows=1 width=58) (actual time=0.263..6.640 rows=190 loops=3)

  • Output: drh_18.calculated, drh_18.calculated_value, drh_18.device_id, drh_18.value, drh_18.updated, r_3.resource_meta_id, r_3.resource_group_id
  • Buffers: shared hit=1731
115. 0.063 0.192 ↑ 1.0 1 3

Merge Join (cost=2.72..2.85 rows=1 width=4) (actual time=0.050..0.064 rows=1 loops=3)

  • Output: d_4.id
  • Merge Cond: (d_4.device_type_id = dt_3.id)
  • Buffers: shared hit=13
116. 0.051 0.090 ↑ 1.0 1 3

Sort (cost=2.52..2.52 rows=1 width=8) (actual time=0.027..0.030 rows=1 loops=3)

  • Output: d_4.id, d_4.device_type_id
  • Sort Key: d_4.device_type_id
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=9
117. 0.039 0.039 ↑ 1.0 1 3

Index Scan using device_pkey on public.device d_4 (cost=0.29..2.51 rows=1 width=8) (actual time=0.010..0.013 rows=1 loops=3)

  • Output: d_4.id, d_4.device_type_id
  • Index Cond: (d_4.id = cd.device_id)
  • Buffers: shared hit=9
118. 0.039 0.039 ↑ 17.0 3 3

Index Only Scan using device_type_pkey on public.device_type dt_3 (cost=0.14..3.10 rows=51 width=4) (actual time=0.007..0.013 rows=3 loops=3)

  • Output: dt_3.id
  • Heap Fetches: 0
  • Buffers: shared hit=4
119. 5.319 17.025 ↓ 190.0 190 3

Nested Loop (cost=4.16..19.97 rows=1 width=58) (actual time=0.198..5.675 rows=190 loops=3)

  • Output: drh_18.calculated, drh_18.calculated_value, drh_18.device_id, drh_18.value, drh_18.updated, r_3.resource_meta_id, r_3.resource_group_id
  • Join Filter: (drh_18.resource_id = r_3.id)
  • Buffers: shared hit=1718
120. 2.825 8.292 ↓ 31.7 190 3

Hash Join (cost=4.02..17.38 rows=6 width=58) (actual time=0.183..2.764 rows=190 loops=3)

  • Output: drh_18.calculated, drh_18.calculated_value, drh_18.device_id, drh_18.value, drh_18.updated, drh_18.resource_id, u0_3.primary_resource_id
  • Hash Cond: (drh_18.resource_id = u0_3.primary_resource_id)
  • Buffers: shared hit=580
121. 2.745 5.088 ↓ 31.8 191 3

Append (cost=0.00..13.29 rows=6 width=55) (actual time=0.041..1.696 rows=191 loops=3)

  • Buffers: shared hit=577
122. 0.009 0.009 ↓ 0.0 0 3

Seq Scan on public.device_resource_history drh_18 (cost=0.00..0.00 rows=1 width=88) (actual time=0.003..0.003 rows=0 loops=3)

  • Output: drh_18.calculated, drh_18.calculated_value, drh_18.device_id, drh_18.value, drh_18.updated, drh_18.resource_id
  • Filter: ((drh_18.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_18.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_18.updated >= (lower(cd.duration))) AND (drh_18.updated <= (upper(cd.duration))) AND (drh_18.device_id = cd.device_id))
123. 0.642 0.642 ↓ 55.0 55 3

Index Scan Backward using _hyper_6_159_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_159_chunk drh_19 (cost=0.43..2.66 rows=1 width=48) (actual time=0.014..0.214 rows=55 loops=3)

  • Output: drh_19.calculated, drh_19.calculated_value, drh_19.device_id, drh_19.value, drh_19.updated, drh_19.resource_id
  • Index Cond: ((drh_19.device_id = cd.device_id) AND (drh_19.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_19.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_19.updated >= (lower(cd.duration))) AND (drh_19.updated <= (upper(cd.duration))))
  • Buffers: shared hit=159
124. 1.299 1.299 ↓ 111.0 111 3

Index Scan Backward using _hyper_6_161_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_161_chunk drh_20 (cost=0.43..2.66 rows=1 width=48) (actual time=0.016..0.433 rows=111 loops=3)

  • Output: drh_20.calculated, drh_20.calculated_value, drh_20.device_id, drh_20.value, drh_20.updated, drh_20.resource_id
  • Index Cond: ((drh_20.device_id = cd.device_id) AND (drh_20.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_20.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_20.updated >= (lower(cd.duration))) AND (drh_20.updated <= (upper(cd.duration))))
  • Buffers: shared hit=313
125. 0.339 0.339 ↓ 25.0 25 3

Index Scan Backward using _hyper_6_162_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_162_chunk drh_21 (cost=0.43..2.66 rows=1 width=48) (actual time=0.015..0.113 rows=25 loops=3)

  • Output: drh_21.calculated, drh_21.calculated_value, drh_21.device_id, drh_21.value, drh_21.updated, drh_21.resource_id
  • Index Cond: ((drh_21.device_id = cd.device_id) AND (drh_21.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_21.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_21.updated >= (lower(cd.duration))) AND (drh_21.updated <= (upper(cd.duration))))
  • Buffers: shared hit=87
126. 0.027 0.027 ↓ 0.0 0 3

Index Scan Backward using _hyper_6_163_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_163_chunk drh_22 (cost=0.43..2.66 rows=1 width=48) (actual time=0.009..0.009 rows=0 loops=3)

  • Output: drh_22.calculated, drh_22.calculated_value, drh_22.device_id, drh_22.value, drh_22.updated, drh_22.resource_id
  • Index Cond: ((drh_22.device_id = cd.device_id) AND (drh_22.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_22.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_22.updated >= (lower(cd.duration))) AND (drh_22.updated <= (upper(cd.duration))))
  • Buffers: shared hit=9
127. 0.027 0.027 ↓ 0.0 0 3

Index Scan Backward using _hyper_6_164_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_164_chunk drh_23 (cost=0.43..2.66 rows=1 width=48) (actual time=0.009..0.009 rows=0 loops=3)

  • Output: drh_23.calculated, drh_23.calculated_value, drh_23.device_id, drh_23.value, drh_23.updated, drh_23.resource_id
  • Index Cond: ((drh_23.device_id = cd.device_id) AND (drh_23.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_23.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_23.updated >= (lower(cd.duration))) AND (drh_23.updated <= (upper(cd.duration))))
  • Buffers: shared hit=9
128. 0.052 0.379 ↑ 1.0 17 1

Hash (cost=3.81..3.81 rows=17 width=4) (actual time=0.379..0.379 rows=17 loops=1)

  • Output: u0_3.primary_resource_id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=3
129. 0.189 0.327 ↓ 1.1 18 1

HashAggregate (cost=3.64..3.81 rows=17 width=4) (actual time=0.285..0.327 rows=18 loops=1)

  • Output: u0_3.primary_resource_id
  • Group Key: u0_3.primary_resource_id
  • Buffers: shared hit=3
130. 0.138 0.138 ↑ 1.0 51 1

Seq Scan on public.device_type u0_3 (cost=0.00..3.51 rows=51 width=4) (actual time=0.008..0.138 rows=51 loops=1)

  • Output: u0_3.primary_resource_id
  • Buffers: shared hit=3
131. 3.414 3.414 ↑ 1.0 1 569

Index Scan using resource_pkey on public.resource r_3 (cost=0.14..0.42 rows=1 width=12) (actual time=0.003..0.006 rows=1 loops=569)

  • Output: r_3.id, r_3.resource_meta_id, r_3.resource_group_id, r_3.measurement, r_3.field_name, r_3.created, r_3.updated, r_3.deleted
  • Index Cond: (r_3.id = u0_3.primary_resource_id)
  • Buffers: shared hit=1138
132. 3.414 3.414 ↑ 1.0 1 569

Index Scan using resource_meta_pkey on public.resource_meta rm_3 (cost=0.14..0.43 rows=1 width=158) (actual time=0.003..0.006 rows=1 loops=569)

  • Output: rm_3.id, rm_3.resource_group_meta_id, rm_3.code, rm_3.description, rm_3.value_type, rm_3.unit_of_measure, rm_3.attributes, rm_3.created, rm_3.updated, rm_3.deleted
  • Index Cond: (rm_3.id = r_3.resource_meta_id)
  • Buffers: shared hit=1138
133. 3.414 3.414 ↑ 1.0 1 569

Index Scan using resource_group_pkey on public.resource_group rg_3 (cost=0.14..0.19 rows=1 width=8) (actual time=0.003..0.006 rows=1 loops=569)

  • Output: rg_3.id, rg_3.resource_group_meta_id, rg_3.code, rg_3.description, rg_3.created, rg_3.updated, rg_3.deleted
  • Index Cond: (rg_3.id = r_3.resource_group_id)
  • Buffers: shared hit=1138
134. 2.845 2.845 ↑ 1.0 1 569

Index Only Scan using resource_group_meta_pkey on public.resource_group_meta rgm_3 (cost=0.14..0.23 rows=1 width=4) (actual time=0.003..0.005 rows=1 loops=569)

  • Output: rgm_3.id
  • Index Cond: (rgm_3.id = rg_3.resource_group_meta_id)
  • Heap Fetches: 0
  • Buffers: shared hit=570
135. 1.067 5,760.539 ↑ 1.0 1 97

Limit (cost=23.46..23.47 rows=1 width=8) (actual time=59.384..59.387 rows=1 loops=97)

  • Output: drh_24.updated
  • Buffers: shared hit=541653
136. 177.801 5,759.472 ↑ 1.0 1 97

Sort (cost=23.46..23.47 rows=1 width=8) (actual time=59.376..59.376 rows=1 loops=97)

  • Output: drh_24.updated
  • Sort Key: drh_24.updated DESC
  • Sort Method: top-N heapsort Memory: 25kB
  • Buffers: shared hit=541653
137. 643.299 5,581.671 ↓ 704.0 704 97

Nested Loop (cost=7.30..23.45 rows=1 width=8) (actual time=0.171..57.543 rows=704 loops=97)

  • Output: drh_24.updated
  • Buffers: shared hit=541653
138. 662.796 4,528.542 ↓ 704.0 704 97

Nested Loop (cost=7.16..23.21 rows=1 width=12) (actual time=0.158..46.686 rows=704 loops=97)

  • Output: drh_24.updated, rg_4.resource_group_meta_id
  • Buffers: shared hit=473347
139. 671.720 3,455.916 ↓ 704.0 704 97

Nested Loop (cost=7.02..23.01 rows=1 width=12) (actual time=0.142..35.628 rows=704 loops=97)

  • Output: drh_24.updated, r_4.resource_group_id
  • Buffers: shared hit=336737
140. 330.964 2,374.366 ↓ 704.0 704 97

Nested Loop (cost=6.88..22.82 rows=1 width=16) (actual time=0.127..24.478 rows=704 loops=97)

  • Output: drh_24.updated, r_4.resource_meta_id, r_4.resource_group_id
  • Buffers: shared hit=200126
141. 2.037 6.208 ↑ 1.0 1 97

Merge Join (cost=2.72..2.85 rows=1 width=4) (actual time=0.049..0.064 rows=1 loops=97)

  • Output: d_5.id
  • Merge Cond: (d_5.device_type_id = dt_4.id)
  • Buffers: shared hit=389
142. 1.552 2.813 ↑ 1.0 1 97

Sort (cost=2.52..2.52 rows=1 width=8) (actual time=0.025..0.029 rows=1 loops=97)

  • Output: d_5.id, d_5.device_type_id
  • Sort Key: d_5.device_type_id
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=291
143. 1.261 1.261 ↑ 1.0 1 97

Index Scan using device_pkey on public.device d_5 (cost=0.29..2.51 rows=1 width=8) (actual time=0.011..0.013 rows=1 loops=97)

  • Output: d_5.id, d_5.device_type_id
  • Index Cond: (d_5.id = cd.device_id)
  • Buffers: shared hit=291
144. 1.358 1.358 ↑ 17.0 3 97

Index Only Scan using device_type_pkey on public.device_type dt_4 (cost=0.14..3.10 rows=51 width=4) (actual time=0.008..0.014 rows=3 loops=97)

  • Output: dt_4.id
  • Heap Fetches: 0
  • Buffers: shared hit=98
145. 680.062 2,037.194 ↓ 704.0 704 97

Nested Loop (cost=4.16..19.96 rows=1 width=20) (actual time=0.066..21.002 rows=704 loops=97)

  • Output: drh_24.updated, drh_24.device_id, r_4.resource_meta_id, r_4.resource_group_id
  • Join Filter: (drh_24.resource_id = r_4.id)
  • Buffers: shared hit=199737
146. 346.884 947.302 ↓ 117.3 704 97

Hash Join (cost=4.02..17.37 rows=6 width=20) (actual time=0.051..9.766 rows=704 loops=97)

  • Output: drh_24.updated, drh_24.resource_id, drh_24.device_id, u0_4.primary_resource_id
  • Hash Cond: (drh_24.resource_id = u0_4.primary_resource_id)
  • Buffers: shared hit=63127
147. 332.613 600.042 ↓ 118.0 708 97

Append (cost=0.00..13.27 rows=6 width=16) (actual time=0.038..6.186 rows=708 loops=97)

  • Buffers: shared hit=63124
148. 0.291 0.291 ↓ 0.0 0 97

Seq Scan on public.device_resource_history drh_24 (cost=0.00..0.00 rows=1 width=16) (actual time=0.003..0.003 rows=0 loops=97)

  • Output: drh_24.updated, drh_24.resource_id, drh_24.device_id
  • Filter: ((drh_24.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_24.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_24.updated >= (lower(cd.duration))) AND (drh_24.device_id = cd.device_id))
149. 29.682 29.682 ↓ 76.0 76 97

Index Scan Backward using _hyper_6_159_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_159_chunk drh_25 (cost=0.43..2.65 rows=1 width=16) (actual time=0.018..0.306 rows=76 loops=97)

  • Output: drh_25.updated, drh_25.resource_id, drh_25.device_id
  • Index Cond: ((drh_25.device_id = cd.device_id) AND (drh_25.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_25.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_25.updated >= (lower(cd.duration))))
  • Buffers: shared hit=6956
150. 58.685 58.685 ↓ 156.0 156 97

Index Scan Backward using _hyper_6_161_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_161_chunk drh_26 (cost=0.43..2.65 rows=1 width=16) (actual time=0.021..0.605 rows=156 loops=97)

  • Output: drh_26.updated, drh_26.resource_id, drh_26.device_id
  • Index Cond: ((drh_26.device_id = cd.device_id) AND (drh_26.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_26.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_26.updated >= (lower(cd.duration))))
  • Buffers: shared hit=13741
151. 59.946 59.946 ↓ 160.0 160 97

Index Scan Backward using _hyper_6_162_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_162_chunk drh_27 (cost=0.43..2.65 rows=1 width=16) (actual time=0.021..0.618 rows=160 loops=97)

  • Output: drh_27.updated, drh_27.resource_id, drh_27.device_id
  • Index Cond: ((drh_27.device_id = cd.device_id) AND (drh_27.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_27.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_27.updated >= (lower(cd.duration))))
  • Buffers: shared hit=14099
152. 61.401 61.401 ↓ 163.0 163 97

Index Scan Backward using _hyper_6_163_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_163_chunk drh_28 (cost=0.43..2.65 rows=1 width=16) (actual time=0.022..0.633 rows=163 loops=97)

  • Output: drh_28.updated, drh_28.resource_id, drh_28.device_id
  • Index Cond: ((drh_28.device_id = cd.device_id) AND (drh_28.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_28.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_28.updated >= (lower(cd.duration))))
  • Buffers: shared hit=14547
153. 57.424 57.424 ↓ 153.0 153 97

Index Scan Backward using _hyper_6_164_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_164_chunk drh_29 (cost=0.43..2.65 rows=1 width=16) (actual time=0.020..0.592 rows=153 loops=97)

  • Output: drh_29.updated, drh_29.resource_id, drh_29.device_id
  • Index Cond: ((drh_29.device_id = cd.device_id) AND (drh_29.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_29.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_29.updated >= (lower(cd.duration))))
  • Buffers: shared hit=13781
154. 0.055 0.376 ↑ 1.0 17 1

Hash (cost=3.81..3.81 rows=17 width=4) (actual time=0.376..0.376 rows=17 loops=1)

  • Output: u0_4.primary_resource_id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=3
155. 0.174 0.321 ↓ 1.1 18 1

HashAggregate (cost=3.64..3.81 rows=17 width=4) (actual time=0.280..0.321 rows=18 loops=1)

  • Output: u0_4.primary_resource_id
  • Group Key: u0_4.primary_resource_id
  • Buffers: shared hit=3
156. 0.147 0.147 ↑ 1.0 51 1

Seq Scan on public.device_type u0_4 (cost=0.00..3.51 rows=51 width=4) (actual time=0.006..0.147 rows=51 loops=1)

  • Output: u0_4.primary_resource_id
  • Buffers: shared hit=3
157. 409.830 409.830 ↑ 1.0 1 68,305

Index Scan using resource_pkey on public.resource r_4 (cost=0.14..0.42 rows=1 width=12) (actual time=0.003..0.006 rows=1 loops=68,305)

  • Output: r_4.id, r_4.resource_meta_id, r_4.resource_group_id, r_4.measurement, r_4.field_name, r_4.created, r_4.updated, r_4.deleted
  • Index Cond: (r_4.id = u0_4.primary_resource_id)
  • Buffers: shared hit=136610
158. 409.830 409.830 ↑ 1.0 1 68,305

Index Only Scan using resource_meta_pkey on public.resource_meta rm_4 (cost=0.14..0.18 rows=1 width=4) (actual time=0.003..0.006 rows=1 loops=68,305)

  • Output: rm_4.id
  • Index Cond: (rm_4.id = r_4.resource_meta_id)
  • Heap Fetches: 68305
  • Buffers: shared hit=136611
159. 409.830 409.830 ↑ 1.0 1 68,305

Index Scan using resource_group_pkey on public.resource_group rg_4 (cost=0.14..0.19 rows=1 width=8) (actual time=0.003..0.006 rows=1 loops=68,305)

  • Output: rg_4.id, rg_4.resource_group_meta_id, rg_4.code, rg_4.description, rg_4.created, rg_4.updated, rg_4.deleted
  • Index Cond: (rg_4.id = r_4.resource_group_id)
  • Buffers: shared hit=136610
160. 409.830 409.830 ↑ 1.0 1 68,305

Index Only Scan using resource_group_meta_pkey on public.resource_group_meta rgm_4 (cost=0.14..0.23 rows=1 width=4) (actual time=0.003..0.006 rows=1 loops=68,305)

  • Output: rgm_4.id
  • Index Cond: (rgm_4.id = rg_4.resource_group_meta_id)
  • Heap Fetches: 0
  • Buffers: shared hit=68306
161. 0.027 46.959 ↑ 1.0 1 3

Limit (cost=23.48..23.48 rows=1 width=8) (actual time=15.651..15.653 rows=1 loops=3)

  • Output: drh_30.updated
  • Buffers: shared hit=4578
162. 1.485 46.932 ↑ 1.0 1 3

Sort (cost=23.48..23.48 rows=1 width=8) (actual time=15.644..15.644 rows=1 loops=3)

  • Output: drh_30.updated
  • Sort Key: drh_30.updated DESC
  • Sort Method: top-N heapsort Memory: 25kB
  • Buffers: shared hit=4578
163. 5.561 45.447 ↓ 190.0 190 3

Nested Loop (cost=7.30..23.47 rows=1 width=8) (actual time=0.304..15.149 rows=190 loops=3)

  • Output: drh_30.updated
  • Buffers: shared hit=4578
164. 5.205 37.041 ↓ 190.0 190 3

Nested Loop (cost=7.16..23.22 rows=1 width=12) (actual time=0.293..12.347 rows=190 loops=3)

  • Output: drh_30.updated, rg_5.resource_group_meta_id
  • Buffers: shared hit=4008
165. 5.235 28.422 ↓ 190.0 190 3

Nested Loop (cost=7.02..23.02 rows=1 width=12) (actual time=0.281..9.474 rows=190 loops=3)

  • Output: drh_30.updated, r_5.resource_group_id
  • Buffers: shared hit=2870
166. 2.667 19.773 ↓ 190.0 190 3

Nested Loop (cost=6.88..22.83 rows=1 width=16) (actual time=0.269..6.591 rows=190 loops=3)

  • Output: drh_30.updated, r_5.resource_meta_id, r_5.resource_group_id
  • Buffers: shared hit=1731
167. 0.063 0.189 ↑ 1.0 1 3

Merge Join (cost=2.72..2.85 rows=1 width=4) (actual time=0.050..0.063 rows=1 loops=3)

  • Output: d_6.id
  • Merge Cond: (d_6.device_type_id = dt_5.id)
  • Buffers: shared hit=13
168. 0.048 0.087 ↑ 1.0 1 3

Sort (cost=2.52..2.52 rows=1 width=8) (actual time=0.027..0.029 rows=1 loops=3)

  • Output: d_6.id, d_6.device_type_id
  • Sort Key: d_6.device_type_id
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=9
169. 0.039 0.039 ↑ 1.0 1 3

Index Scan using device_pkey on public.device d_6 (cost=0.29..2.51 rows=1 width=8) (actual time=0.009..0.013 rows=1 loops=3)

  • Output: d_6.id, d_6.device_type_id
  • Index Cond: (d_6.id = cd.device_id)
  • Buffers: shared hit=9
170. 0.039 0.039 ↑ 17.0 3 3

Index Only Scan using device_type_pkey on public.device_type dt_5 (cost=0.14..3.10 rows=51 width=4) (actual time=0.008..0.013 rows=3 loops=3)

  • Output: dt_5.id
  • Heap Fetches: 0
  • Buffers: shared hit=4
171. 5.310 16.917 ↓ 190.0 190 3

Nested Loop (cost=4.16..19.97 rows=1 width=20) (actual time=0.204..5.639 rows=190 loops=3)

  • Output: drh_30.updated, drh_30.device_id, r_5.resource_meta_id, r_5.resource_group_id
  • Join Filter: (drh_30.resource_id = r_5.id)
  • Buffers: shared hit=1718
172. 2.807 8.193 ↓ 31.7 190 3

Hash Join (cost=4.02..17.38 rows=6 width=20) (actual time=0.190..2.731 rows=190 loops=3)

  • Output: drh_30.updated, drh_30.resource_id, drh_30.device_id, u0_5.primary_resource_id
  • Hash Cond: (drh_30.resource_id = u0_5.primary_resource_id)
  • Buffers: shared hit=580
173. 2.742 5.004 ↓ 31.8 191 3

Append (cost=0.00..13.29 rows=6 width=16) (actual time=0.047..1.668 rows=191 loops=3)

  • Buffers: shared hit=577
174. 0.012 0.012 ↓ 0.0 0 3

Seq Scan on public.device_resource_history drh_30 (cost=0.00..0.00 rows=1 width=16) (actual time=0.004..0.004 rows=0 loops=3)

  • Output: drh_30.updated, drh_30.resource_id, drh_30.device_id
  • Filter: ((drh_30.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_30.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_30.updated >= (lower(cd.duration))) AND (drh_30.updated <= (upper(cd.duration))) AND (drh_30.device_id = cd.device_id))
175. 0.618 0.618 ↓ 55.0 55 3

Index Scan Backward using _hyper_6_159_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_159_chunk drh_31 (cost=0.43..2.66 rows=1 width=16) (actual time=0.015..0.206 rows=55 loops=3)

  • Output: drh_31.updated, drh_31.resource_id, drh_31.device_id
  • Index Cond: ((drh_31.device_id = cd.device_id) AND (drh_31.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_31.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_31.updated >= (lower(cd.duration))) AND (drh_31.updated <= (upper(cd.duration))))
  • Buffers: shared hit=159
176. 1.254 1.254 ↓ 111.0 111 3

Index Scan Backward using _hyper_6_161_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_161_chunk drh_32 (cost=0.43..2.66 rows=1 width=16) (actual time=0.021..0.418 rows=111 loops=3)

  • Output: drh_32.updated, drh_32.resource_id, drh_32.device_id
  • Index Cond: ((drh_32.device_id = cd.device_id) AND (drh_32.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_32.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_32.updated >= (lower(cd.duration))) AND (drh_32.updated <= (upper(cd.duration))))
  • Buffers: shared hit=313
177. 0.330 0.330 ↓ 25.0 25 3

Index Scan Backward using _hyper_6_162_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_162_chunk drh_33 (cost=0.43..2.66 rows=1 width=16) (actual time=0.011..0.110 rows=25 loops=3)

  • Output: drh_33.updated, drh_33.resource_id, drh_33.device_id
  • Index Cond: ((drh_33.device_id = cd.device_id) AND (drh_33.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_33.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_33.updated >= (lower(cd.duration))) AND (drh_33.updated <= (upper(cd.duration))))
  • Buffers: shared hit=87
178. 0.024 0.024 ↓ 0.0 0 3

Index Scan Backward using _hyper_6_163_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_163_chunk drh_34 (cost=0.43..2.66 rows=1 width=16) (actual time=0.008..0.008 rows=0 loops=3)

  • Output: drh_34.updated, drh_34.resource_id, drh_34.device_id
  • Index Cond: ((drh_34.device_id = cd.device_id) AND (drh_34.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_34.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_34.updated >= (lower(cd.duration))) AND (drh_34.updated <= (upper(cd.duration))))
  • Buffers: shared hit=9
179. 0.024 0.024 ↓ 0.0 0 3

Index Scan Backward using _hyper_6_164_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_164_chunk drh_35 (cost=0.43..2.66 rows=1 width=16) (actual time=0.008..0.008 rows=0 loops=3)

  • Output: drh_35.updated, drh_35.resource_id, drh_35.device_id
  • Index Cond: ((drh_35.device_id = cd.device_id) AND (drh_35.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_35.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_35.updated >= (lower(cd.duration))) AND (drh_35.updated <= (upper(cd.duration))))
  • Buffers: shared hit=9
180. 0.064 0.382 ↑ 1.0 17 1

Hash (cost=3.81..3.81 rows=17 width=4) (actual time=0.382..0.382 rows=17 loops=1)

  • Output: u0_5.primary_resource_id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=3
181. 0.182 0.318 ↓ 1.1 18 1

HashAggregate (cost=3.64..3.81 rows=17 width=4) (actual time=0.270..0.318 rows=18 loops=1)

  • Output: u0_5.primary_resource_id
  • Group Key: u0_5.primary_resource_id
  • Buffers: shared hit=3
182. 0.136 0.136 ↑ 1.0 51 1

Seq Scan on public.device_type u0_5 (cost=0.00..3.51 rows=51 width=4) (actual time=0.008..0.136 rows=51 loops=1)

  • Output: u0_5.primary_resource_id
  • Buffers: shared hit=3
183. 3.414 3.414 ↑ 1.0 1 569

Index Scan using resource_pkey on public.resource r_5 (cost=0.14..0.42 rows=1 width=12) (actual time=0.003..0.006 rows=1 loops=569)

  • Output: r_5.id, r_5.resource_meta_id, r_5.resource_group_id, r_5.measurement, r_5.field_name, r_5.created, r_5.updated, r_5.deleted
  • Index Cond: (r_5.id = u0_5.primary_resource_id)
  • Buffers: shared hit=1138
184. 3.414 3.414 ↑ 1.0 1 569

Index Only Scan using resource_meta_pkey on public.resource_meta rm_5 (cost=0.14..0.18 rows=1 width=4) (actual time=0.003..0.006 rows=1 loops=569)

  • Output: rm_5.id
  • Index Cond: (rm_5.id = r_5.resource_meta_id)
  • Heap Fetches: 569
  • Buffers: shared hit=1139
185. 3.414 3.414 ↑ 1.0 1 569

Index Scan using resource_group_pkey on public.resource_group rg_5 (cost=0.14..0.19 rows=1 width=8) (actual time=0.003..0.006 rows=1 loops=569)

  • Output: rg_5.id, rg_5.resource_group_meta_id, rg_5.code, rg_5.description, rg_5.created, rg_5.updated, rg_5.deleted
  • Index Cond: (rg_5.id = r_5.resource_group_id)
  • Buffers: shared hit=1138
186. 2.845 2.845 ↑ 1.0 1 569

Index Only Scan using resource_group_meta_pkey on public.resource_group_meta rgm_5 (cost=0.14..0.23 rows=1 width=4) (actual time=0.003..0.005 rows=1 loops=569)

  • Output: rgm_5.id
  • Index Cond: (rgm_5.id = rg_5.resource_group_meta_id)
  • Heap Fetches: 0
  • Buffers: shared hit=570
187. 0.873 5,802.734 ↑ 1.0 1 97

Limit (cost=23.72..24.00 rows=1 width=40) (actual time=59.819..59.822 rows=1 loops=97)

  • Output: (CASE WHEN (drh_36.calculated IS NOT NULL) THEN drh_36.calculated_value ELSE (CASE WHEN ((rm_6.attributes ->> 'calculation'::text) IS NOT NULL) THEN get_device_resource_calculated(drh_36.device_id, rm_6.attributes, drh_36.value, drh_36.updated) ELSE ((drh_36.value)::text)::numeric END * COALESCE(((rm_6.attributes ->> 'scale'::text))::numeric, '1'::numeric)) END), drh_36.updated
  • Buffers: shared hit=541652
188. 0.970 5,801.861 ↑ 1.0 1 97

Result (cost=23.72..24.00 rows=1 width=40) (actual time=59.813..59.813 rows=1 loops=97)

  • Output: CASE WHEN (drh_36.calculated IS NOT NULL) THEN drh_36.calculated_value ELSE (CASE WHEN ((rm_6.attributes ->> 'calculation'::text) IS NOT NULL) THEN get_device_resource_calculated(drh_36.device_id, rm_6.attributes, drh_36.value, drh_36.updated) ELSE ((drh_36.value)::text)::numeric END * COALESCE(((rm_6.attributes ->> 'scale'::text))::numeric, '1'::numeric)) END, drh_36.updated
  • Buffers: shared hit=541652
189. 187.598 5,800.891 ↑ 1.0 1 97

Sort (cost=23.72..23.72 rows=1 width=204) (actual time=59.803..59.803 rows=1 loops=97)

  • Output: drh_36.updated, drh_36.calculated, drh_36.calculated_value, rm_6.attributes, drh_36.device_id, drh_36.value
  • Sort Key: drh_36.updated DESC
  • Sort Method: top-N heapsort Memory: 25kB
  • Buffers: shared hit=541652
190. 649.119 5,613.293 ↓ 704.0 704 97

Nested Loop (cost=7.30..23.71 rows=1 width=204) (actual time=0.179..57.869 rows=704 loops=97)

  • Output: drh_36.updated, drh_36.calculated, drh_36.calculated_value, rm_6.attributes, drh_36.device_id, drh_36.value
  • Buffers: shared hit=541652
191. 672.011 4,554.344 ↓ 704.0 704 97

Nested Loop (cost=7.16..23.46 rows=1 width=208) (actual time=0.162..46.952 rows=704 loops=97)

  • Output: drh_36.calculated, drh_36.calculated_value, drh_36.device_id, drh_36.value, drh_36.updated, rm_6.attributes, rg_6.resource_group_meta_id
  • Buffers: shared hit=473346
192. 673.854 3,472.503 ↓ 704.0 704 97

Nested Loop (cost=7.02..23.26 rows=1 width=208) (actual time=0.145..35.799 rows=704 loops=97)

  • Output: drh_36.calculated, drh_36.calculated_value, drh_36.device_id, drh_36.value, drh_36.updated, r_6.resource_group_id, rm_6.attributes
  • Buffers: shared hit=336736
193. 332.128 2,388.819 ↓ 704.0 704 97

Nested Loop (cost=6.88..22.82 rows=1 width=58) (actual time=0.130..24.627 rows=704 loops=97)

  • Output: drh_36.calculated, drh_36.calculated_value, drh_36.device_id, drh_36.value, drh_36.updated, r_6.resource_meta_id, r_6.resource_group_id
  • Buffers: shared hit=200126
194. 2.231 6.402 ↑ 1.0 1 97

Merge Join (cost=2.72..2.85 rows=1 width=4) (actual time=0.049..0.066 rows=1 loops=97)

  • Output: d_7.id
  • Merge Cond: (d_7.device_type_id = dt_6.id)
  • Buffers: shared hit=389
195. 1.455 2.716 ↑ 1.0 1 97

Sort (cost=2.52..2.52 rows=1 width=8) (actual time=0.025..0.028 rows=1 loops=97)

  • Output: d_7.id, d_7.device_type_id
  • Sort Key: d_7.device_type_id
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=291
196. 1.261 1.261 ↑ 1.0 1 97

Index Scan using device_pkey on public.device d_7 (cost=0.29..2.51 rows=1 width=8) (actual time=0.010..0.013 rows=1 loops=97)

  • Output: d_7.id, d_7.device_type_id
  • Index Cond: (d_7.id = cd.device_id)
  • Buffers: shared hit=291
197. 1.455 1.455 ↑ 17.0 3 97

Index Only Scan using device_type_pkey on public.device_type dt_6 (cost=0.14..3.10 rows=51 width=4) (actual time=0.009..0.015 rows=3 loops=97)

  • Output: dt_6.id
  • Heap Fetches: 0
  • Buffers: shared hit=98
198. 681.226 2,050.289 ↓ 704.0 704 97

Nested Loop (cost=4.16..19.96 rows=1 width=58) (actual time=0.067..21.137 rows=704 loops=97)

  • Output: drh_36.calculated, drh_36.calculated_value, drh_36.device_id, drh_36.value, drh_36.updated, r_6.resource_meta_id, r_6.resource_group_id
  • Join Filter: (drh_36.resource_id = r_6.id)
  • Buffers: shared hit=199737
199. 350.425 959.233 ↓ 117.3 704 97

Hash Join (cost=4.02..17.37 rows=6 width=58) (actual time=0.051..9.889 rows=704 loops=97)

  • Output: drh_36.calculated, drh_36.calculated_value, drh_36.device_id, drh_36.value, drh_36.updated, drh_36.resource_id, u0_6.primary_resource_id
  • Hash Cond: (drh_36.resource_id = u0_6.primary_resource_id)
  • Buffers: shared hit=63127
200. 333.971 608.384 ↓ 118.0 708 97

Append (cost=0.00..13.27 rows=6 width=55) (actual time=0.036..6.272 rows=708 loops=97)

  • Buffers: shared hit=63124
201. 0.291 0.291 ↓ 0.0 0 97

Seq Scan on public.device_resource_history drh_36 (cost=0.00..0.00 rows=1 width=88) (actual time=0.003..0.003 rows=0 loops=97)

  • Output: drh_36.calculated, drh_36.calculated_value, drh_36.device_id, drh_36.value, drh_36.updated, drh_36.resource_id
  • Filter: ((drh_36.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_36.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_36.updated >= (lower(cd.duration))) AND (drh_36.device_id = cd.device_id))
202. 30.167 30.167 ↓ 76.0 76 97

Index Scan Backward using _hyper_6_159_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_159_chunk drh_37 (cost=0.43..2.65 rows=1 width=48) (actual time=0.018..0.311 rows=76 loops=97)

  • Output: drh_37.calculated, drh_37.calculated_value, drh_37.device_id, drh_37.value, drh_37.updated, drh_37.resource_id
  • Index Cond: ((drh_37.device_id = cd.device_id) AND (drh_37.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_37.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_37.updated >= (lower(cd.duration))))
  • Buffers: shared hit=6956
203. 60.722 60.722 ↓ 156.0 156 97

Index Scan Backward using _hyper_6_161_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_161_chunk drh_38 (cost=0.43..2.65 rows=1 width=48) (actual time=0.020..0.626 rows=156 loops=97)

  • Output: drh_38.calculated, drh_38.calculated_value, drh_38.device_id, drh_38.value, drh_38.updated, drh_38.resource_id
  • Index Cond: ((drh_38.device_id = cd.device_id) AND (drh_38.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_38.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_38.updated >= (lower(cd.duration))))
  • Buffers: shared hit=13741
204. 61.692 61.692 ↓ 160.0 160 97

Index Scan Backward using _hyper_6_162_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_162_chunk drh_39 (cost=0.43..2.65 rows=1 width=48) (actual time=0.020..0.636 rows=160 loops=97)

  • Output: drh_39.calculated, drh_39.calculated_value, drh_39.device_id, drh_39.value, drh_39.updated, drh_39.resource_id
  • Index Cond: ((drh_39.device_id = cd.device_id) AND (drh_39.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_39.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_39.updated >= (lower(cd.duration))))
  • Buffers: shared hit=14099
205. 62.177 62.177 ↓ 163.0 163 97

Index Scan Backward using _hyper_6_163_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_163_chunk drh_40 (cost=0.43..2.65 rows=1 width=48) (actual time=0.021..0.641 rows=163 loops=97)

  • Output: drh_40.calculated, drh_40.calculated_value, drh_40.device_id, drh_40.value, drh_40.updated, drh_40.resource_id
  • Index Cond: ((drh_40.device_id = cd.device_id) AND (drh_40.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_40.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_40.updated >= (lower(cd.duration))))
  • Buffers: shared hit=14547
206. 59.364 59.364 ↓ 153.0 153 97

Index Scan Backward using _hyper_6_164_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_164_chunk drh_41 (cost=0.43..2.65 rows=1 width=48) (actual time=0.021..0.612 rows=153 loops=97)

  • Output: drh_41.calculated, drh_41.calculated_value, drh_41.device_id, drh_41.value, drh_41.updated, drh_41.resource_id
  • Index Cond: ((drh_41.device_id = cd.device_id) AND (drh_41.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_41.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_41.updated >= (lower(cd.duration))))
  • Buffers: shared hit=13781
207. 0.054 0.424 ↑ 1.0 17 1

Hash (cost=3.81..3.81 rows=17 width=4) (actual time=0.424..0.424 rows=17 loops=1)

  • Output: u0_6.primary_resource_id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=3
208. 0.178 0.370 ↓ 1.1 18 1

HashAggregate (cost=3.64..3.81 rows=17 width=4) (actual time=0.328..0.370 rows=18 loops=1)

  • Output: u0_6.primary_resource_id
  • Group Key: u0_6.primary_resource_id
  • Buffers: shared hit=3
209. 0.192 0.192 ↑ 1.0 51 1

Seq Scan on public.device_type u0_6 (cost=0.00..3.51 rows=51 width=4) (actual time=0.006..0.192 rows=51 loops=1)

  • Output: u0_6.primary_resource_id
  • Buffers: shared hit=3
210. 409.830 409.830 ↑ 1.0 1 68,305

Index Scan using resource_pkey on public.resource r_6 (cost=0.14..0.42 rows=1 width=12) (actual time=0.003..0.006 rows=1 loops=68,305)

  • Output: r_6.id, r_6.resource_meta_id, r_6.resource_group_id, r_6.measurement, r_6.field_name, r_6.created, r_6.updated, r_6.deleted
  • Index Cond: (r_6.id = u0_6.primary_resource_id)
  • Buffers: shared hit=136610
211. 409.830 409.830 ↑ 1.0 1 68,305

Index Scan using resource_meta_pkey on public.resource_meta rm_6 (cost=0.14..0.43 rows=1 width=158) (actual time=0.003..0.006 rows=1 loops=68,305)

  • Output: rm_6.id, rm_6.resource_group_meta_id, rm_6.code, rm_6.description, rm_6.value_type, rm_6.unit_of_measure, rm_6.attributes, rm_6.created, rm_6.updated, rm_6.deleted
  • Index Cond: (rm_6.id = r_6.resource_meta_id)
  • Buffers: shared hit=136610
212. 409.830 409.830 ↑ 1.0 1 68,305

Index Scan using resource_group_pkey on public.resource_group rg_6 (cost=0.14..0.19 rows=1 width=8) (actual time=0.003..0.006 rows=1 loops=68,305)

  • Output: rg_6.id, rg_6.resource_group_meta_id, rg_6.code, rg_6.description, rg_6.created, rg_6.updated, rg_6.deleted
  • Index Cond: (rg_6.id = r_6.resource_group_id)
  • Buffers: shared hit=136610
213. 409.830 409.830 ↑ 1.0 1 68,305

Index Only Scan using resource_group_meta_pkey on public.resource_group_meta rgm_6 (cost=0.14..0.23 rows=1 width=4) (actual time=0.003..0.006 rows=1 loops=68,305)

  • Output: rgm_6.id
  • Index Cond: (rgm_6.id = rg_6.resource_group_meta_id)
  • Heap Fetches: 0
  • Buffers: shared hit=68306
214. 0.021 47.478 ↑ 1.0 1 3

Limit (cost=23.73..24.02 rows=1 width=40) (actual time=15.824..15.826 rows=1 loops=3)

  • Output: (CASE WHEN (drh_42.calculated IS NOT NULL) THEN drh_42.calculated_value ELSE (CASE WHEN ((rm_7.attributes ->> 'calculation'::text) IS NOT NULL) THEN get_device_resource_calculated(drh_42.device_id, rm_7.attributes, drh_42.value, drh_42.updated) ELSE ((drh_42.value)::text)::numeric END * COALESCE(((rm_7.attributes ->> 'scale'::text))::numeric, '1'::numeric)) END), drh_42.updated
  • Buffers: shared hit=4577
215. 0.027 47.457 ↑ 1.0 1 3

Result (cost=23.73..24.02 rows=1 width=40) (actual time=15.819..15.819 rows=1 loops=3)

  • Output: CASE WHEN (drh_42.calculated IS NOT NULL) THEN drh_42.calculated_value ELSE (CASE WHEN ((rm_7.attributes ->> 'calculation'::text) IS NOT NULL) THEN get_device_resource_calculated(drh_42.device_id, rm_7.attributes, drh_42.value, drh_42.updated) ELSE ((drh_42.value)::text)::numeric END * COALESCE(((rm_7.attributes ->> 'scale'::text))::numeric, '1'::numeric)) END, drh_42.updated
  • Buffers: shared hit=4577
216. 1.551 47.430 ↑ 1.0 1 3

Sort (cost=23.73..23.73 rows=1 width=204) (actual time=15.810..15.810 rows=1 loops=3)

  • Output: drh_42.updated, drh_42.calculated, drh_42.calculated_value, rm_7.attributes, drh_42.device_id, drh_42.value
  • Sort Key: drh_42.updated DESC
  • Sort Method: top-N heapsort Memory: 25kB
  • Buffers: shared hit=4577
217. 5.657 45.879 ↓ 190.0 190 3

Nested Loop (cost=7.30..23.72 rows=1 width=204) (actual time=0.297..15.293 rows=190 loops=3)

  • Output: drh_42.updated, drh_42.calculated, drh_42.calculated_value, rm_7.attributes, drh_42.device_id, drh_42.value
  • Buffers: shared hit=4577
218. 5.211 37.377 ↓ 190.0 190 3

Nested Loop (cost=7.16..23.48 rows=1 width=208) (actual time=0.284..12.459 rows=190 loops=3)

  • Output: drh_42.calculated, drh_42.calculated_value, drh_42.device_id, drh_42.value, drh_42.updated, rm_7.attributes, rg_7.resource_group_meta_id
  • Buffers: shared hit=4007
219. 5.493 28.752 ↓ 190.0 190 3

Nested Loop (cost=7.02..23.28 rows=1 width=208) (actual time=0.268..9.584 rows=190 loops=3)

  • Output: drh_42.calculated, drh_42.calculated_value, drh_42.device_id, drh_42.value, drh_42.updated, r_7.resource_group_id, rm_7.attributes
  • Buffers: shared hit=2869
220. 2.712 19.845 ↓ 190.0 190 3

Nested Loop (cost=6.88..22.83 rows=1 width=58) (actual time=0.257..6.615 rows=190 loops=3)

  • Output: drh_42.calculated, drh_42.calculated_value, drh_42.device_id, drh_42.value, drh_42.updated, r_7.resource_meta_id, r_7.resource_group_id
  • Buffers: shared hit=1731
221. 0.060 0.192 ↑ 1.0 1 3

Merge Join (cost=2.72..2.85 rows=1 width=4) (actual time=0.050..0.064 rows=1 loops=3)

  • Output: d_8.id
  • Merge Cond: (d_8.device_type_id = dt_7.id)
  • Buffers: shared hit=13
222. 0.057 0.093 ↑ 1.0 1 3

Sort (cost=2.52..2.52 rows=1 width=8) (actual time=0.028..0.031 rows=1 loops=3)

  • Output: d_8.id, d_8.device_type_id
  • Sort Key: d_8.device_type_id
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=9
223. 0.036 0.036 ↑ 1.0 1 3

Index Scan using device_pkey on public.device d_8 (cost=0.29..2.51 rows=1 width=8) (actual time=0.009..0.012 rows=1 loops=3)

  • Output: d_8.id, d_8.device_type_id
  • Index Cond: (d_8.id = cd.device_id)
  • Buffers: shared hit=9
224. 0.039 0.039 ↑ 17.0 3 3

Index Only Scan using device_type_pkey on public.device_type dt_7 (cost=0.14..3.10 rows=51 width=4) (actual time=0.008..0.013 rows=3 loops=3)

  • Output: dt_7.id
  • Heap Fetches: 0
  • Buffers: shared hit=4
225. 5.274 16.941 ↓ 190.0 190 3

Nested Loop (cost=4.16..19.97 rows=1 width=58) (actual time=0.191..5.647 rows=190 loops=3)

  • Output: drh_42.calculated, drh_42.calculated_value, drh_42.device_id, drh_42.value, drh_42.updated, r_7.resource_meta_id, r_7.resource_group_id
  • Join Filter: (drh_42.resource_id = r_7.id)
  • Buffers: shared hit=1718
226. 2.853 8.253 ↓ 31.7 190 3

Hash Join (cost=4.02..17.38 rows=6 width=58) (actual time=0.178..2.751 rows=190 loops=3)

  • Output: drh_42.calculated, drh_42.calculated_value, drh_42.device_id, drh_42.value, drh_42.updated, drh_42.resource_id, u0_7.primary_resource_id
  • Hash Cond: (drh_42.resource_id = u0_7.primary_resource_id)
  • Buffers: shared hit=580
227. 2.706 5.025 ↓ 31.8 191 3

Append (cost=0.00..13.29 rows=6 width=55) (actual time=0.037..1.675 rows=191 loops=3)

  • Buffers: shared hit=577
228. 0.009 0.009 ↓ 0.0 0 3

Seq Scan on public.device_resource_history drh_42 (cost=0.00..0.00 rows=1 width=88) (actual time=0.003..0.003 rows=0 loops=3)

  • Output: drh_42.calculated, drh_42.calculated_value, drh_42.device_id, drh_42.value, drh_42.updated, drh_42.resource_id
  • Filter: ((drh_42.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_42.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_42.updated >= (lower(cd.duration))) AND (drh_42.updated <= (upper(cd.duration))) AND (drh_42.device_id = cd.device_id))
229. 0.624 0.624 ↓ 55.0 55 3

Index Scan Backward using _hyper_6_159_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_159_chunk drh_43 (cost=0.43..2.66 rows=1 width=48) (actual time=0.011..0.208 rows=55 loops=3)

  • Output: drh_43.calculated, drh_43.calculated_value, drh_43.device_id, drh_43.value, drh_43.updated, drh_43.resource_id
  • Index Cond: ((drh_43.device_id = cd.device_id) AND (drh_43.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_43.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_43.updated >= (lower(cd.duration))) AND (drh_43.updated <= (upper(cd.duration))))
  • Buffers: shared hit=159
230. 1.278 1.278 ↓ 111.0 111 3

Index Scan Backward using _hyper_6_161_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_161_chunk drh_44 (cost=0.43..2.66 rows=1 width=48) (actual time=0.015..0.426 rows=111 loops=3)

  • Output: drh_44.calculated, drh_44.calculated_value, drh_44.device_id, drh_44.value, drh_44.updated, drh_44.resource_id
  • Index Cond: ((drh_44.device_id = cd.device_id) AND (drh_44.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_44.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_44.updated >= (lower(cd.duration))) AND (drh_44.updated <= (upper(cd.duration))))
  • Buffers: shared hit=313
231. 0.360 0.360 ↓ 25.0 25 3

Index Scan Backward using _hyper_6_162_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_162_chunk drh_45 (cost=0.43..2.66 rows=1 width=48) (actual time=0.015..0.120 rows=25 loops=3)

  • Output: drh_45.calculated, drh_45.calculated_value, drh_45.device_id, drh_45.value, drh_45.updated, drh_45.resource_id
  • Index Cond: ((drh_45.device_id = cd.device_id) AND (drh_45.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_45.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_45.updated >= (lower(cd.duration))) AND (drh_45.updated <= (upper(cd.duration))))
  • Buffers: shared hit=87
232. 0.024 0.024 ↓ 0.0 0 3

Index Scan Backward using _hyper_6_163_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_163_chunk drh_46 (cost=0.43..2.66 rows=1 width=48) (actual time=0.008..0.008 rows=0 loops=3)

  • Output: drh_46.calculated, drh_46.calculated_value, drh_46.device_id, drh_46.value, drh_46.updated, drh_46.resource_id
  • Index Cond: ((drh_46.device_id = cd.device_id) AND (drh_46.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_46.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_46.updated >= (lower(cd.duration))) AND (drh_46.updated <= (upper(cd.duration))))
  • Buffers: shared hit=9
233. 0.024 0.024 ↓ 0.0 0 3

Index Scan Backward using _hyper_6_164_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_164_chunk drh_47 (cost=0.43..2.66 rows=1 width=48) (actual time=0.008..0.008 rows=0 loops=3)

  • Output: drh_47.calculated, drh_47.calculated_value, drh_47.device_id, drh_47.value, drh_47.updated, drh_47.resource_id
  • Index Cond: ((drh_47.device_id = cd.device_id) AND (drh_47.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_47.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_47.updated >= (lower(cd.duration))) AND (drh_47.updated <= (upper(cd.duration))))
  • Buffers: shared hit=9
234. 0.057 0.375 ↑ 1.0 17 1

Hash (cost=3.81..3.81 rows=17 width=4) (actual time=0.375..0.375 rows=17 loops=1)

  • Output: u0_7.primary_resource_id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=3
235. 0.189 0.318 ↓ 1.1 18 1

HashAggregate (cost=3.64..3.81 rows=17 width=4) (actual time=0.263..0.318 rows=18 loops=1)

  • Output: u0_7.primary_resource_id
  • Group Key: u0_7.primary_resource_id
  • Buffers: shared hit=3
236. 0.129 0.129 ↑ 1.0 51 1

Seq Scan on public.device_type u0_7 (cost=0.00..3.51 rows=51 width=4) (actual time=0.006..0.129 rows=51 loops=1)

  • Output: u0_7.primary_resource_id
  • Buffers: shared hit=3
237. 3.414 3.414 ↑ 1.0 1 569

Index Scan using resource_pkey on public.resource r_7 (cost=0.14..0.42 rows=1 width=12) (actual time=0.003..0.006 rows=1 loops=569)

  • Output: r_7.id, r_7.resource_meta_id, r_7.resource_group_id, r_7.measurement, r_7.field_name, r_7.created, r_7.updated, r_7.deleted
  • Index Cond: (r_7.id = u0_7.primary_resource_id)
  • Buffers: shared hit=1138
238. 3.414 3.414 ↑ 1.0 1 569

Index Scan using resource_meta_pkey on public.resource_meta rm_7 (cost=0.14..0.43 rows=1 width=158) (actual time=0.003..0.006 rows=1 loops=569)

  • Output: rm_7.id, rm_7.resource_group_meta_id, rm_7.code, rm_7.description, rm_7.value_type, rm_7.unit_of_measure, rm_7.attributes, rm_7.created, rm_7.updated, rm_7.deleted
  • Index Cond: (rm_7.id = r_7.resource_meta_id)
  • Buffers: shared hit=1138
239. 3.414 3.414 ↑ 1.0 1 569

Index Scan using resource_group_pkey on public.resource_group rg_7 (cost=0.14..0.19 rows=1 width=8) (actual time=0.003..0.006 rows=1 loops=569)

  • Output: rg_7.id, rg_7.resource_group_meta_id, rg_7.code, rg_7.description, rg_7.created, rg_7.updated, rg_7.deleted
  • Index Cond: (rg_7.id = r_7.resource_group_id)
  • Buffers: shared hit=1138
240. 2.845 2.845 ↑ 1.0 1 569

Index Only Scan using resource_group_meta_pkey on public.resource_group_meta rgm_7 (cost=0.14..0.23 rows=1 width=4) (actual time=0.003..0.005 rows=1 loops=569)

  • Output: rgm_7.id
  • Index Cond: (rgm_7.id = rg_7.resource_group_meta_id)
  • Heap Fetches: 0
  • Buffers: shared hit=570
241. 0.873 5,762.091 ↑ 1.0 1 97

Limit (cost=23.72..24.00 rows=1 width=40) (actual time=59.400..59.403 rows=1 loops=97)

  • Output: (CASE WHEN (drh_48.calculated IS NOT NULL) THEN drh_48.calculated_value ELSE (CASE WHEN ((rm_8.attributes ->> 'calculation'::text) IS NOT NULL) THEN get_device_resource_calculated(drh_48.device_id, rm_8.attributes, drh_48.value, drh_48.updated) ELSE ((drh_48.value)::text)::numeric END * COALESCE(((rm_8.attributes ->> 'scale'::text))::numeric, '1'::numeric)) END), drh_48.updated
  • Buffers: shared hit=540855
242. 0.970 5,761.218 ↑ 1.0 1 97

Result (cost=23.72..24.00 rows=1 width=40) (actual time=59.394..59.394 rows=1 loops=97)

  • Output: CASE WHEN (drh_48.calculated IS NOT NULL) THEN drh_48.calculated_value ELSE (CASE WHEN ((rm_8.attributes ->> 'calculation'::text) IS NOT NULL) THEN get_device_resource_calculated(drh_48.device_id, rm_8.attributes, drh_48.value, drh_48.updated) ELSE ((drh_48.value)::text)::numeric END * COALESCE(((rm_8.attributes ->> 'scale'::text))::numeric, '1'::numeric)) END, drh_48.updated
  • Buffers: shared hit=540855
243. 185.561 5,760.248 ↑ 1.0 1 97

Sort (cost=23.72..23.72 rows=1 width=204) (actual time=59.384..59.384 rows=1 loops=97)

  • Output: drh_48.updated, drh_48.calculated, drh_48.calculated_value, rm_8.attributes, drh_48.device_id, drh_48.value
  • Sort Key: drh_48.updated
  • Sort Method: top-N heapsort Memory: 25kB
  • Buffers: shared hit=540855
244. 638.449 5,574.687 ↓ 704.0 704 97

Nested Loop (cost=7.30..23.71 rows=1 width=204) (actual time=0.173..57.471 rows=704 loops=97)

  • Output: drh_48.updated, drh_48.calculated, drh_48.calculated_value, rm_8.attributes, drh_48.device_id, drh_48.value
  • Buffers: shared hit=540855
245. 664.057 4,526.408 ↓ 704.0 704 97

Nested Loop (cost=7.16..23.46 rows=1 width=208) (actual time=0.159..46.664 rows=704 loops=97)

  • Output: drh_48.calculated, drh_48.calculated_value, drh_48.device_id, drh_48.value, drh_48.updated, rm_8.attributes, rg_8.resource_group_meta_id
  • Buffers: shared hit=472549
246. 669.295 3,452.521 ↓ 704.0 704 97

Nested Loop (cost=7.02..23.26 rows=1 width=208) (actual time=0.146..35.593 rows=704 loops=97)

  • Output: drh_48.calculated, drh_48.calculated_value, drh_48.device_id, drh_48.value, drh_48.updated, r_8.resource_group_id, rm_8.attributes
  • Buffers: shared hit=335939
247. 330.770 2,373.396 ↓ 704.0 704 97

Nested Loop (cost=6.88..22.82 rows=1 width=58) (actual time=0.131..24.468 rows=704 loops=97)

  • Output: drh_48.calculated, drh_48.calculated_value, drh_48.device_id, drh_48.value, drh_48.updated, r_8.resource_meta_id, r_8.resource_group_id
  • Buffers: shared hit=199329
248. 2.231 6.596 ↑ 1.0 1 97

Merge Join (cost=2.72..2.85 rows=1 width=4) (actual time=0.051..0.068 rows=1 loops=97)

  • Output: d_9.id
  • Merge Cond: (d_9.device_type_id = dt_8.id)
  • Buffers: shared hit=389
249. 1.552 2.813 ↑ 1.0 1 97

Sort (cost=2.52..2.52 rows=1 width=8) (actual time=0.025..0.029 rows=1 loops=97)

  • Output: d_9.id, d_9.device_type_id
  • Sort Key: d_9.device_type_id
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=291
250. 1.261 1.261 ↑ 1.0 1 97

Index Scan using device_pkey on public.device d_9 (cost=0.29..2.51 rows=1 width=8) (actual time=0.011..0.013 rows=1 loops=97)

  • Output: d_9.id, d_9.device_type_id
  • Index Cond: (d_9.id = cd.device_id)
  • Buffers: shared hit=291
251. 1.552 1.552 ↑ 17.0 3 97

Index Only Scan using device_type_pkey on public.device_type dt_8 (cost=0.14..3.10 rows=51 width=4) (actual time=0.009..0.016 rows=3 loops=97)

  • Output: dt_8.id
  • Heap Fetches: 0
  • Buffers: shared hit=98
252. 675.503 2,036.030 ↓ 704.0 704 97

Nested Loop (cost=4.16..19.96 rows=1 width=58) (actual time=0.067..20.990 rows=704 loops=97)

  • Output: drh_48.calculated, drh_48.calculated_value, drh_48.device_id, drh_48.value, drh_48.updated, r_8.resource_meta_id, r_8.resource_group_id
  • Join Filter: (drh_48.resource_id = r_8.id)
  • Buffers: shared hit=198940
253. 349.202 950.697 ↓ 117.3 704 97

Hash Join (cost=4.02..17.37 rows=6 width=58) (actual time=0.052..9.801 rows=704 loops=97)

  • Output: drh_48.calculated, drh_48.calculated_value, drh_48.device_id, drh_48.value, drh_48.updated, drh_48.resource_id, u0_8.primary_resource_id
  • Hash Cond: (drh_48.resource_id = u0_8.primary_resource_id)
  • Buffers: shared hit=62330
254. 331.546 600.818 ↓ 118.0 708 97

Append (cost=0.00..13.27 rows=6 width=55) (actual time=0.036..6.194 rows=708 loops=97)

  • Buffers: shared hit=62327
255. 0.291 0.291 ↓ 0.0 0 97

Seq Scan on public.device_resource_history drh_48 (cost=0.00..0.00 rows=1 width=88) (actual time=0.003..0.003 rows=0 loops=97)

  • Output: drh_48.calculated, drh_48.calculated_value, drh_48.device_id, drh_48.value, drh_48.updated, drh_48.resource_id
  • Filter: ((drh_48.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_48.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_48.updated >= (lower(cd.duration))) AND (drh_48.device_id = cd.device_id))
256. 29.973 29.973 ↓ 76.0 76 97

Index Scan using _hyper_6_159_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_159_chunk drh_49 (cost=0.43..2.65 rows=1 width=48) (actual time=0.017..0.309 rows=76 loops=97)

  • Output: drh_49.calculated, drh_49.calculated_value, drh_49.device_id, drh_49.value, drh_49.updated, drh_49.resource_id
  • Index Cond: ((drh_49.device_id = cd.device_id) AND (drh_49.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_49.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_49.updated >= (lower(cd.duration))))
  • Buffers: shared hit=6859
257. 59.267 59.267 ↓ 156.0 156 97

Index Scan using _hyper_6_161_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_161_chunk drh_50 (cost=0.43..2.65 rows=1 width=48) (actual time=0.016..0.611 rows=156 loops=97)

  • Output: drh_50.calculated, drh_50.calculated_value, drh_50.device_id, drh_50.value, drh_50.updated, drh_50.resource_id
  • Index Cond: ((drh_50.device_id = cd.device_id) AND (drh_50.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_50.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_50.updated >= (lower(cd.duration))))
  • Buffers: shared hit=13571
258. 60.528 60.528 ↓ 160.0 160 97

Index Scan using _hyper_6_162_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_162_chunk drh_51 (cost=0.43..2.65 rows=1 width=48) (actual time=0.015..0.624 rows=160 loops=97)

  • Output: drh_51.calculated, drh_51.calculated_value, drh_51.device_id, drh_51.value, drh_51.updated, drh_51.resource_id
  • Index Cond: ((drh_51.device_id = cd.device_id) AND (drh_51.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_51.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_51.updated >= (lower(cd.duration))))
  • Buffers: shared hit=13922
259. 61.983 61.983 ↓ 163.0 163 97

Index Scan using _hyper_6_163_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_163_chunk drh_52 (cost=0.43..2.65 rows=1 width=48) (actual time=0.016..0.639 rows=163 loops=97)

  • Output: drh_52.calculated, drh_52.calculated_value, drh_52.device_id, drh_52.value, drh_52.updated, drh_52.resource_id
  • Index Cond: ((drh_52.device_id = cd.device_id) AND (drh_52.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_52.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_52.updated >= (lower(cd.duration))))
  • Buffers: shared hit=14371
260. 57.230 57.230 ↓ 153.0 153 97

Index Scan using _hyper_6_164_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_164_chunk drh_53 (cost=0.43..2.65 rows=1 width=48) (actual time=0.015..0.590 rows=153 loops=97)

  • Output: drh_53.calculated, drh_53.calculated_value, drh_53.device_id, drh_53.value, drh_53.updated, drh_53.resource_id
  • Index Cond: ((drh_53.device_id = cd.device_id) AND (drh_53.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_53.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_53.updated >= (lower(cd.duration))))
  • Buffers: shared hit=13604
261. 0.058 0.677 ↑ 1.0 17 1

Hash (cost=3.81..3.81 rows=17 width=4) (actual time=0.677..0.677 rows=17 loops=1)

  • Output: u0_8.primary_resource_id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=3
262. 0.434 0.619 ↓ 1.1 18 1

HashAggregate (cost=3.64..3.81 rows=17 width=4) (actual time=0.576..0.619 rows=18 loops=1)

  • Output: u0_8.primary_resource_id
  • Group Key: u0_8.primary_resource_id
  • Buffers: shared hit=3
263. 0.185 0.185 ↑ 1.0 51 1

Seq Scan on public.device_type u0_8 (cost=0.00..3.51 rows=51 width=4) (actual time=0.006..0.185 rows=51 loops=1)

  • Output: u0_8.primary_resource_id
  • Buffers: shared hit=3
264. 409.830 409.830 ↑ 1.0 1 68,305

Index Scan using resource_pkey on public.resource r_8 (cost=0.14..0.42 rows=1 width=12) (actual time=0.003..0.006 rows=1 loops=68,305)

  • Output: r_8.id, r_8.resource_meta_id, r_8.resource_group_id, r_8.measurement, r_8.field_name, r_8.created, r_8.updated, r_8.deleted
  • Index Cond: (r_8.id = u0_8.primary_resource_id)
  • Buffers: shared hit=136610
265. 409.830 409.830 ↑ 1.0 1 68,305

Index Scan using resource_meta_pkey on public.resource_meta rm_8 (cost=0.14..0.43 rows=1 width=158) (actual time=0.003..0.006 rows=1 loops=68,305)

  • Output: rm_8.id, rm_8.resource_group_meta_id, rm_8.code, rm_8.description, rm_8.value_type, rm_8.unit_of_measure, rm_8.attributes, rm_8.created, rm_8.updated, rm_8.deleted
  • Index Cond: (rm_8.id = r_8.resource_meta_id)
  • Buffers: shared hit=136610
266. 409.830 409.830 ↑ 1.0 1 68,305

Index Scan using resource_group_pkey on public.resource_group rg_8 (cost=0.14..0.19 rows=1 width=8) (actual time=0.003..0.006 rows=1 loops=68,305)

  • Output: rg_8.id, rg_8.resource_group_meta_id, rg_8.code, rg_8.description, rg_8.created, rg_8.updated, rg_8.deleted
  • Index Cond: (rg_8.id = r_8.resource_group_id)
  • Buffers: shared hit=136610
267. 409.830 409.830 ↑ 1.0 1 68,305

Index Only Scan using resource_group_meta_pkey on public.resource_group_meta rgm_8 (cost=0.14..0.23 rows=1 width=4) (actual time=0.003..0.006 rows=1 loops=68,305)

  • Output: rgm_8.id
  • Index Cond: (rgm_8.id = rg_8.resource_group_meta_id)
  • Heap Fetches: 0
  • Buffers: shared hit=68306
268. 0.024 47.415 ↑ 1.0 1 3

Limit (cost=23.73..24.02 rows=1 width=40) (actual time=15.803..15.805 rows=1 loops=3)

  • Output: (CASE WHEN (drh_54.calculated IS NOT NULL) THEN drh_54.calculated_value ELSE (CASE WHEN ((rm_9.attributes ->> 'calculation'::text) IS NOT NULL) THEN get_device_resource_calculated(drh_54.device_id, rm_9.attributes, drh_54.value, drh_54.updated) ELSE ((drh_54.value)::text)::numeric END * COALESCE(((rm_9.attributes ->> 'scale'::text))::numeric, '1'::numeric)) END), drh_54.updated
  • Buffers: shared hit=4570
269. 0.024 47.391 ↑ 1.0 1 3

Result (cost=23.73..24.02 rows=1 width=40) (actual time=15.797..15.797 rows=1 loops=3)

  • Output: CASE WHEN (drh_54.calculated IS NOT NULL) THEN drh_54.calculated_value ELSE (CASE WHEN ((rm_9.attributes ->> 'calculation'::text) IS NOT NULL) THEN get_device_resource_calculated(drh_54.device_id, rm_9.attributes, drh_54.value, drh_54.updated) ELSE ((drh_54.value)::text)::numeric END * COALESCE(((rm_9.attributes ->> 'scale'::text))::numeric, '1'::numeric)) END, drh_54.updated
  • Buffers: shared hit=4570
270. 1.533 47.367 ↑ 1.0 1 3

Sort (cost=23.73..23.73 rows=1 width=204) (actual time=15.789..15.789 rows=1 loops=3)

  • Output: drh_54.updated, drh_54.calculated, drh_54.calculated_value, rm_9.attributes, drh_54.device_id, drh_54.value
  • Sort Key: drh_54.updated
  • Sort Method: top-N heapsort Memory: 25kB
  • Buffers: shared hit=4570
271. 5.675 45.834 ↓ 190.0 190 3

Nested Loop (cost=7.30..23.72 rows=1 width=204) (actual time=0.284..15.278 rows=190 loops=3)

  • Output: drh_54.updated, drh_54.calculated, drh_54.calculated_value, rm_9.attributes, drh_54.device_id, drh_54.value
  • Buffers: shared hit=4570
272. 5.244 37.314 ↓ 190.0 190 3

Nested Loop (cost=7.16..23.48 rows=1 width=208) (actual time=0.271..12.438 rows=190 loops=3)

  • Output: drh_54.calculated, drh_54.calculated_value, drh_54.device_id, drh_54.value, drh_54.updated, rm_9.attributes, rg_9.resource_group_meta_id
  • Buffers: shared hit=4000
273. 5.256 28.656 ↓ 190.0 190 3

Nested Loop (cost=7.02..23.28 rows=1 width=208) (actual time=0.260..9.552 rows=190 loops=3)

  • Output: drh_54.calculated, drh_54.calculated_value, drh_54.device_id, drh_54.value, drh_54.updated, r_9.resource_group_id, rm_9.attributes
  • Buffers: shared hit=2862
274. 2.715 19.986 ↓ 190.0 190 3

Nested Loop (cost=6.88..22.83 rows=1 width=58) (actual time=0.249..6.662 rows=190 loops=3)

  • Output: drh_54.calculated, drh_54.calculated_value, drh_54.device_id, drh_54.value, drh_54.updated, r_9.resource_meta_id, r_9.resource_group_id
  • Buffers: shared hit=1724
275. 0.057 0.174 ↑ 1.0 1 3

Merge Join (cost=2.72..2.85 rows=1 width=4) (actual time=0.044..0.058 rows=1 loops=3)

  • Output: d_10.id
  • Merge Cond: (d_10.device_type_id = dt_9.id)
  • Buffers: shared hit=13
276. 0.048 0.078 ↑ 1.0 1 3

Sort (cost=2.52..2.52 rows=1 width=8) (actual time=0.023..0.026 rows=1 loops=3)

  • Output: d_10.id, d_10.device_type_id
  • Sort Key: d_10.device_type_id
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=9
277. 0.030 0.030 ↑ 1.0 1 3

Index Scan using device_pkey on public.device d_10 (cost=0.29..2.51 rows=1 width=8) (actual time=0.008..0.010 rows=1 loops=3)

  • Output: d_10.id, d_10.device_type_id
  • Index Cond: (d_10.id = cd.device_id)
  • Buffers: shared hit=9
278. 0.039 0.039 ↑ 17.0 3 3

Index Only Scan using device_type_pkey on public.device_type dt_9 (cost=0.14..3.10 rows=51 width=4) (actual time=0.007..0.013 rows=3 loops=3)

  • Output: dt_9.id
  • Heap Fetches: 0
  • Buffers: shared hit=4
279. 5.343 17.097 ↓ 190.0 190 3

Nested Loop (cost=4.16..19.97 rows=1 width=58) (actual time=0.189..5.699 rows=190 loops=3)

  • Output: drh_54.calculated, drh_54.calculated_value, drh_54.device_id, drh_54.value, drh_54.updated, r_9.resource_meta_id, r_9.resource_group_id
  • Join Filter: (drh_54.resource_id = r_9.id)
  • Buffers: shared hit=1711
280. 2.803 8.340 ↓ 31.7 190 3

Hash Join (cost=4.02..17.38 rows=6 width=58) (actual time=0.176..2.780 rows=190 loops=3)

  • Output: drh_54.calculated, drh_54.calculated_value, drh_54.device_id, drh_54.value, drh_54.updated, drh_54.resource_id, u0_9.primary_resource_id
  • Hash Cond: (drh_54.resource_id = u0_9.primary_resource_id)
  • Buffers: shared hit=573
281. 2.853 5.175 ↓ 31.8 191 3

Append (cost=0.00..13.29 rows=6 width=55) (actual time=0.039..1.725 rows=191 loops=3)

  • Buffers: shared hit=570
282. 0.009 0.009 ↓ 0.0 0 3

Seq Scan on public.device_resource_history drh_54 (cost=0.00..0.00 rows=1 width=88) (actual time=0.003..0.003 rows=0 loops=3)

  • Output: drh_54.calculated, drh_54.calculated_value, drh_54.device_id, drh_54.value, drh_54.updated, drh_54.resource_id
  • Filter: ((drh_54.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_54.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_54.updated >= (lower(cd.duration))) AND (drh_54.updated <= (upper(cd.duration))) AND (drh_54.device_id = cd.device_id))
283. 0.639 0.639 ↓ 55.0 55 3

Index Scan using _hyper_6_159_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_159_chunk drh_55 (cost=0.43..2.66 rows=1 width=48) (actual time=0.012..0.213 rows=55 loops=3)

  • Output: drh_55.calculated, drh_55.calculated_value, drh_55.device_id, drh_55.value, drh_55.updated, drh_55.resource_id
  • Index Cond: ((drh_55.device_id = cd.device_id) AND (drh_55.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_55.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_55.updated >= (lower(cd.duration))) AND (drh_55.updated <= (upper(cd.duration))))
  • Buffers: shared hit=157
284. 1.281 1.281 ↓ 111.0 111 3

Index Scan using _hyper_6_161_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_161_chunk drh_56 (cost=0.43..2.66 rows=1 width=48) (actual time=0.012..0.427 rows=111 loops=3)

  • Output: drh_56.calculated, drh_56.calculated_value, drh_56.device_id, drh_56.value, drh_56.updated, drh_56.resource_id
  • Index Cond: ((drh_56.device_id = cd.device_id) AND (drh_56.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_56.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_56.updated >= (lower(cd.duration))) AND (drh_56.updated <= (upper(cd.duration))))
  • Buffers: shared hit=310
285. 0.333 0.333 ↓ 25.0 25 3

Index Scan using _hyper_6_162_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_162_chunk drh_57 (cost=0.43..2.66 rows=1 width=48) (actual time=0.012..0.111 rows=25 loops=3)

  • Output: drh_57.calculated, drh_57.calculated_value, drh_57.device_id, drh_57.value, drh_57.updated, drh_57.resource_id
  • Index Cond: ((drh_57.device_id = cd.device_id) AND (drh_57.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_57.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_57.updated >= (lower(cd.duration))) AND (drh_57.updated <= (upper(cd.duration))))
  • Buffers: shared hit=85
286. 0.027 0.027 ↓ 0.0 0 3

Index Scan using _hyper_6_163_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_163_chunk drh_58 (cost=0.43..2.66 rows=1 width=48) (actual time=0.009..0.009 rows=0 loops=3)

  • Output: drh_58.calculated, drh_58.calculated_value, drh_58.device_id, drh_58.value, drh_58.updated, drh_58.resource_id
  • Index Cond: ((drh_58.device_id = cd.device_id) AND (drh_58.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_58.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_58.updated >= (lower(cd.duration))) AND (drh_58.updated <= (upper(cd.duration))))
  • Buffers: shared hit=9
287. 0.033 0.033 ↓ 0.0 0 3

Index Scan using _hyper_6_164_chunk_device_resource_history_updated_device_id_id on _timescaledb_internal._hyper_6_164_chunk drh_59 (cost=0.43..2.66 rows=1 width=48) (actual time=0.011..0.011 rows=0 loops=3)

  • Output: drh_59.calculated, drh_59.calculated_value, drh_59.device_id, drh_59.value, drh_59.updated, drh_59.resource_id
  • Index Cond: ((drh_59.device_id = cd.device_id) AND (drh_59.updated >= '2020-04-12 14:00:00+00'::timestamp with time zone) AND (drh_59.updated <= '2020-05-13 14:00:00+00'::timestamp with time zone) AND (drh_59.updated >= (lower(cd.duration))) AND (drh_59.updated <= (upper(cd.duration))))
  • Buffers: shared hit=9
288. 0.052 0.362 ↑ 1.0 17 1

Hash (cost=3.81..3.81 rows=17 width=4) (actual time=0.362..0.362 rows=17 loops=1)

  • Output: u0_9.primary_resource_id
  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
  • Buffers: shared hit=3
289. 0.173 0.310 ↓ 1.1 18 1

HashAggregate (cost=3.64..3.81 rows=17 width=4) (actual time=0.269..0.310 rows=18 loops=1)

  • Output: u0_9.primary_resource_id
  • Group Key: u0_9.primary_resource_id
  • Buffers: shared hit=3
290. 0.137 0.137 ↑ 1.0 51 1

Seq Scan on public.device_type u0_9 (cost=0.00..3.51 rows=51 width=4) (actual time=0.008..0.137 rows=51 loops=1)

  • Output: u0_9.primary_resource_id
  • Buffers: shared hit=3
291. 3.414 3.414 ↑ 1.0 1 569

Index Scan using resource_pkey on public.resource r_9 (cost=0.14..0.42 rows=1 width=12) (actual time=0.003..0.006 rows=1 loops=569)

  • Output: r_9.id, r_9.resource_meta_id, r_9.resource_group_id, r_9.measurement, r_9.field_name, r_9.created, r_9.updated, r_9.deleted
  • Index Cond: (r_9.id = u0_9.primary_resource_id)
  • Buffers: shared hit=1138
292. 3.414 3.414 ↑ 1.0 1 569

Index Scan using resource_meta_pkey on public.resource_meta rm_9 (cost=0.14..0.43 rows=1 width=158) (actual time=0.003..0.006 rows=1 loops=569)

  • Output: rm_9.id, rm_9.resource_group_meta_id, rm_9.code, rm_9.description, rm_9.value_type, rm_9.unit_of_measure, rm_9.attributes, rm_9.created, rm_9.updated, rm_9.deleted
  • Index Cond: (rm_9.id = r_9.resource_meta_id)
  • Buffers: shared hit=1138
293. 3.414 3.414 ↑ 1.0 1 569

Index Scan using resource_group_pkey on public.resource_group rg_9 (cost=0.14..0.19 rows=1 width=8) (actual time=0.003..0.006 rows=1 loops=569)

  • Output: rg_9.id, rg_9.resource_group_meta_id, rg_9.code, rg_9.description, rg_9.created, rg_9.updated, rg_9.deleted
  • Index Cond: (rg_9.id = r_9.resource_group_id)
  • Buffers: shared hit=1138
294. 2.845 2.845 ↑ 1.0 1 569

Index Only Scan using resource_group_meta_pkey on public.resource_group_meta rgm_9 (cost=0.14..0.23 rows=1 width=4) (actual time=0.003..0.005 rows=1 loops=569)

  • Output: rgm_9.id
  • Index Cond: (rgm_9.id = rg_9.resource_group_meta_id)
  • Heap Fetches: 0
  • Buffers: shared hit=570
Planning time : 144.539 ms
Execution time : 31,559.935 ms