explain.depesz.com

PostgreSQL's explain analyze made readable

Result: XkCU

Settings
# exclusive inclusive rows x rows loops node
1. 3.409 41.840 ↓ 41.2 2,927 1

Nested Loop Left Join (cost=3.56..4,283.36 rows=71 width=2,052) (actual time=12.165..41.840 rows=2,927 loops=1)

  • Output: sn.trackable_id, sn.version, sn.bill_of_lading, sn.master_leg_id, sn.deleted_at, sn.id, sn.origin_port_id, sn.master_shipment_id, sn.discriminator, sn.inactive_clock, sn.deleted_by, sn.tenant_id, sn.destination_port_id, sn.active_clock, sn.loading_port_id, sn.created_at, sn.created_by, sn.start_time, c.created_at, c.id, c.container_number, cs.line_description, cs.version, cs.site_id, cs.container_id, cs.last_free_day, cs.carrier_identifier, cs.customs_description, cs.id, cs.remote_clock, cs.last_time, cs.other_description, cs.bill_of_lading, cs.demurrage, cs.first_time, cs.names, cs.local_clock, s.name, s.created_at, s.id, s.length, s.width, s.location_id, s.site_key, s.version, s.ship_type, s.discriminator, s.mmsi, s.call_sign, ss.local_clock, ss.version, ss.location_id, ss.site_id, ss.lat, ss.names, ss.eta, ss.remote_clock, ss.lon, ss.discriminator, ss.draught, ss.last_time, ss.first_time, ss.id, sp.latitude, sp.region, sp.country, sp.address_line1, sp.state, sp.id, sp.address_line2, sp.location_name, sp.postal_code, sp.discriminator, sp.port_code, sp.longitude, sp.city, sp.time_zone_id, ssp.latitude, ssp.address_line1, ssp.country, ssp.address_line2, ssp.state, ssp.longitude, ssp.region, ssp.id, ssp.port_code, ssp.location_name, ssp.city, ssp.discriminator, ssp.postal_code, ssp.time_zone_id, dp.postal_code, dp.address_line2, dp.location_name, dp.id, dp.discriminator, dp.region, dp.country, dp.state, dp.port_code, dp.address_line1, dp.latitude, dp.city, dp.longitude, dp.time_zone_id, op.longitude, op.time_zone_id, op.address_line1, op.postal_code, op.region, op.country, op.city, op.latitude, op.state, op.id, op.address_line2, op.location_name, op.discriminator, op.port_code, lp.time_zone_id, lp.port_code, lp.id, lp.address_line1, lp.longitude, lp.city, lp.latitude, lp.state, lp.postal_code, lp.country, lp.address_line2, lp.location_name, lp.discriminator, lp.region
2. 3.490 32.577 ↓ 41.2 2,927 1

Nested Loop Left Join (cost=3.13..3,682.87 rows=71 width=1,786) (actual time=12.162..32.577 rows=2,927 loops=1)

  • Output: sn.trackable_id, sn.version, sn.bill_of_lading, sn.master_leg_id, sn.deleted_at, sn.id, sn.origin_port_id, sn.master_shipment_id, sn.discriminator, sn.inactive_clock, sn.deleted_by, sn.tenant_id, sn.destination_port_id, sn.active_clock, sn.loading_port_id, sn.created_at, sn.created_by, sn.start_time, c.created_at, c.id, c.container_number, cs.line_description, cs.version, cs.site_id, cs.container_id, cs.last_free_day, cs.carrier_identifier, cs.customs_description, cs.id, cs.remote_clock, cs.last_time, cs.other_description, cs.bill_of_lading, cs.demurrage, cs.first_time, cs.names, cs.local_clock, s.name, s.created_at, s.id, s.length, s.width, s.location_id, s.site_key, s.version, s.ship_type, s.discriminator, s.mmsi, s.call_sign, sp.latitude, sp.region, sp.country, sp.address_line1, sp.state, sp.id, sp.address_line2, sp.location_name, sp.postal_code, sp.discriminator, sp.port_code, sp.longitude, sp.city, sp.time_zone_id, ss.local_clock, ss.version, ss.location_id, ss.site_id, ss.lat, ss.names, ss.eta, ss.remote_clock, ss.lon, ss.discriminator, ss.draught, ss.last_time, ss.first_time, ss.id, ssp.latitude, ssp.address_line1, ssp.country, ssp.address_line2, ssp.state, ssp.longitude, ssp.region, ssp.id, ssp.port_code, ssp.location_name, ssp.city, ssp.discriminator, ssp.postal_code, ssp.time_zone_id, dp.postal_code, dp.address_line2, dp.location_name, dp.id, dp.discriminator, dp.region, dp.country, dp.state, dp.port_code, dp.address_line1, dp.latitude, dp.city, dp.longitude, dp.time_zone_id, op.longitude, op.time_zone_id, op.address_line1, op.postal_code, op.region, op.country, op.city, op.latitude, op.state, op.id, op.address_line2, op.location_name, op.discriminator, op.port_code
3. 3.513 29.087 ↓ 41.2 2,927 1

Nested Loop Left Join (cost=2.70..3,082.39 rows=71 width=1,520) (actual time=12.158..29.087 rows=2,927 loops=1)

  • Output: sn.trackable_id, sn.version, sn.bill_of_lading, sn.master_leg_id, sn.deleted_at, sn.id, sn.origin_port_id, sn.master_shipment_id, sn.discriminator, sn.inactive_clock, sn.deleted_by, sn.tenant_id, sn.destination_port_id, sn.active_clock, sn.loading_port_id, sn.created_at, sn.created_by, sn.start_time, c.created_at, c.id, c.container_number, cs.line_description, cs.version, cs.site_id, cs.container_id, cs.last_free_day, cs.carrier_identifier, cs.customs_description, cs.id, cs.remote_clock, cs.last_time, cs.other_description, cs.bill_of_lading, cs.demurrage, cs.first_time, cs.names, cs.local_clock, s.name, s.created_at, s.id, s.length, s.width, s.location_id, s.site_key, s.version, s.ship_type, s.discriminator, s.mmsi, s.call_sign, sp.latitude, sp.region, sp.country, sp.address_line1, sp.state, sp.id, sp.address_line2, sp.location_name, sp.postal_code, sp.discriminator, sp.port_code, sp.longitude, sp.city, sp.time_zone_id, ss.local_clock, ss.version, ss.location_id, ss.site_id, ss.lat, ss.names, ss.eta, ss.remote_clock, ss.lon, ss.discriminator, ss.draught, ss.last_time, ss.first_time, ss.id, ssp.latitude, ssp.address_line1, ssp.country, ssp.address_line2, ssp.state, ssp.longitude, ssp.region, ssp.id, ssp.port_code, ssp.location_name, ssp.city, ssp.discriminator, ssp.postal_code, ssp.time_zone_id, dp.postal_code, dp.address_line2, dp.location_name, dp.id, dp.discriminator, dp.region, dp.country, dp.state, dp.port_code, dp.address_line1, dp.latitude, dp.city, dp.longitude, dp.time_zone_id
4. 3.963 25.574 ↓ 41.2 2,927 1

Nested Loop Left Join (cost=2.27..3,030.51 rows=71 width=1,254) (actual time=12.156..25.574 rows=2,927 loops=1)

  • Output: sn.trackable_id, sn.version, sn.bill_of_lading, sn.master_leg_id, sn.deleted_at, sn.id, sn.origin_port_id, sn.master_shipment_id, sn.discriminator, sn.inactive_clock, sn.deleted_by, sn.tenant_id, sn.destination_port_id, sn.active_clock, sn.loading_port_id, sn.created_at, sn.created_by, sn.start_time, c.created_at, c.id, c.container_number, cs.line_description, cs.version, cs.site_id, cs.container_id, cs.last_free_day, cs.carrier_identifier, cs.customs_description, cs.id, cs.remote_clock, cs.last_time, cs.other_description, cs.bill_of_lading, cs.demurrage, cs.first_time, cs.names, cs.local_clock, s.name, s.created_at, s.id, s.length, s.width, s.location_id, s.site_key, s.version, s.ship_type, s.discriminator, s.mmsi, s.call_sign, sp.latitude, sp.region, sp.country, sp.address_line1, sp.state, sp.id, sp.address_line2, sp.location_name, sp.postal_code, sp.discriminator, sp.port_code, sp.longitude, sp.city, sp.time_zone_id, ss.local_clock, ss.version, ss.location_id, ss.site_id, ss.lat, ss.names, ss.eta, ss.remote_clock, ss.lon, ss.discriminator, ss.draught, ss.last_time, ss.first_time, ss.id, dp.postal_code, dp.address_line2, dp.location_name, dp.id, dp.discriminator, dp.region, dp.country, dp.state, dp.port_code, dp.address_line1, dp.latitude, dp.city, dp.longitude, dp.time_zone_id
  • Join Filter: ((COALESCE(sn.start_time, sn.created_at) <= ss.first_time) AND (ss.first_time <= COALESCE((sn.deleted_at)::timestamp with time zone, now())))
  • Rows Removed by Join Filter: 6423
5. 0.011 13.741 ↓ 5.0 5 1

Nested Loop Left Join (cost=1.84..2,854.56 rows=1 width=1,097) (actual time=12.150..13.741 rows=5 loops=1)

  • Output: sn.trackable_id, sn.version, sn.bill_of_lading, sn.master_leg_id, sn.deleted_at, sn.id, sn.origin_port_id, sn.master_shipment_id, sn.discriminator, sn.inactive_clock, sn.deleted_by, sn.tenant_id, sn.destination_port_id, sn.active_clock, sn.loading_port_id, sn.created_at, sn.created_by, sn.start_time, c.created_at, c.id, c.container_number, cs.line_description, cs.version, cs.site_id, cs.container_id, cs.last_free_day, cs.carrier_identifier, cs.customs_description, cs.id, cs.remote_clock, cs.last_time, cs.other_description, cs.bill_of_lading, cs.demurrage, cs.first_time, cs.names, cs.local_clock, s.name, s.created_at, s.id, s.length, s.width, s.location_id, s.site_key, s.version, s.ship_type, s.discriminator, s.mmsi, s.call_sign, sp.latitude, sp.region, sp.country, sp.address_line1, sp.state, sp.id, sp.address_line2, sp.location_name, sp.postal_code, sp.discriminator, sp.port_code, sp.longitude, sp.city, sp.time_zone_id, dp.postal_code, dp.address_line2, dp.location_name, dp.id, dp.discriminator, dp.region, dp.country, dp.state, dp.port_code, dp.address_line1, dp.latitude, dp.city, dp.longitude, dp.time_zone_id
6. 0.004 13.715 ↓ 5.0 5 1

Nested Loop Left Join (cost=1.42..2,846.11 rows=1 width=831) (actual time=12.143..13.715 rows=5 loops=1)

  • Output: sn.trackable_id, sn.version, sn.bill_of_lading, sn.master_leg_id, sn.deleted_at, sn.id, sn.origin_port_id, sn.master_shipment_id, sn.discriminator, sn.inactive_clock, sn.deleted_by, sn.tenant_id, sn.destination_port_id, sn.active_clock, sn.loading_port_id, sn.created_at, sn.created_by, sn.start_time, c.created_at, c.id, c.container_number, cs.line_description, cs.version, cs.site_id, cs.container_id, cs.last_free_day, cs.carrier_identifier, cs.customs_description, cs.id, cs.remote_clock, cs.last_time, cs.other_description, cs.bill_of_lading, cs.demurrage, cs.first_time, cs.names, cs.local_clock, s.name, s.created_at, s.id, s.length, s.width, s.location_id, s.site_key, s.version, s.ship_type, s.discriminator, s.mmsi, s.call_sign, sp.latitude, sp.region, sp.country, sp.address_line1, sp.state, sp.id, sp.address_line2, sp.location_name, sp.postal_code, sp.discriminator, sp.port_code, sp.longitude, sp.city, sp.time_zone_id
7. 0.008 13.701 ↓ 5.0 5 1

Nested Loop Left Join (cost=0.99..2,837.95 rows=1 width=565) (actual time=12.136..13.701 rows=5 loops=1)

  • Output: sn.trackable_id, sn.version, sn.bill_of_lading, sn.master_leg_id, sn.deleted_at, sn.id, sn.origin_port_id, sn.master_shipment_id, sn.discriminator, sn.inactive_clock, sn.deleted_by, sn.tenant_id, sn.destination_port_id, sn.active_clock, sn.loading_port_id, sn.created_at, sn.created_by, sn.start_time, c.created_at, c.id, c.container_number, cs.line_description, cs.version, cs.site_id, cs.container_id, cs.last_free_day, cs.carrier_identifier, cs.customs_description, cs.id, cs.remote_clock, cs.last_time, cs.other_description, cs.bill_of_lading, cs.demurrage, cs.first_time, cs.names, cs.local_clock, s.name, s.created_at, s.id, s.length, s.width, s.location_id, s.site_key, s.version, s.ship_type, s.discriminator, s.mmsi, s.call_sign
8. 0.015 13.678 ↓ 5.0 5 1

Nested Loop Left Join (cost=0.71..2,837.64 rows=1 width=465) (actual time=12.129..13.678 rows=5 loops=1)

  • Output: sn.trackable_id, sn.version, sn.bill_of_lading, sn.master_leg_id, sn.deleted_at, sn.id, sn.origin_port_id, sn.master_shipment_id, sn.discriminator, sn.inactive_clock, sn.deleted_by, sn.tenant_id, sn.destination_port_id, sn.active_clock, sn.loading_port_id, sn.created_at, sn.created_by, sn.start_time, c.created_at, c.id, c.container_number, cs.line_description, cs.version, cs.site_id, cs.container_id, cs.last_free_day, cs.carrier_identifier, cs.customs_description, cs.id, cs.remote_clock, cs.last_time, cs.other_description, cs.bill_of_lading, cs.demurrage, cs.first_time, cs.names, cs.local_clock
  • Join Filter: ((COALESCE(sn.start_time, sn.created_at) <= cs.first_time) AND (cs.first_time <= COALESCE((sn.deleted_at)::timestamp with time zone, now())))
9. 0.005 13.651 ↑ 1.0 1 1

Nested Loop (cost=0.29..2,835.80 rows=1 width=237) (actual time=12.115..13.651 rows=1 loops=1)

  • Output: sn.trackable_id, sn.version, sn.bill_of_lading, sn.master_leg_id, sn.deleted_at, sn.id, sn.origin_port_id, sn.master_shipment_id, sn.discriminator, sn.inactive_clock, sn.deleted_by, sn.tenant_id, sn.destination_port_id, sn.active_clock, sn.loading_port_id, sn.created_at, sn.created_by, sn.start_time, c.created_at, c.id, c.container_number
10. 13.638 13.638 ↑ 1.0 1 1

Seq Scan on public.tracking_session sn (cost=0.00..2,827.48 rows=1 width=201) (actual time=12.103..13.638 rows=1 loops=1)

  • Output: sn.id, sn.discriminator, sn.version, sn.active_clock, sn.inactive_clock, sn.master_leg_id, sn.master_shipment_id, sn.trackable_id, sn.tenant_id, sn.created_by, sn.created_at, sn.deleted_by, sn.deleted_at, sn.bill_of_lading, sn.destination_port_id, sn.loading_port_id, sn.origin_port_id, sn.start_time
  • Filter: (((sn.discriminator)::text = 'container'::text) AND (sn.master_shipment_id = '091c6f96-8116-42dc-ae7d-de570564975f'::uuid))
  • Rows Removed by Filter: 64033
11. 0.008 0.008 ↑ 1.0 1 1

Index Scan using pk_container on public.container c (cost=0.29..8.30 rows=1 width=36) (actual time=0.008..0.008 rows=1 loops=1)

  • Output: c.created_at, c.id, c.container_number
  • Index Cond: (c.id = sn.trackable_id)
12. 0.012 0.012 ↑ 1.8 5 1

Index Scan using container_status_container_id_first_time_ix on public.container_status cs (cost=0.42..1.66 rows=9 width=228) (actual time=0.006..0.012 rows=5 loops=1)

  • Output: cs.line_description, cs.version, cs.site_id, cs.container_id, cs.last_free_day, cs.carrier_identifier, cs.customs_description, cs.id, cs.remote_clock, cs.last_time, cs.other_description, cs.bill_of_lading, cs.demurrage, cs.first_time, cs.names, cs.local_clock
  • Index Cond: (cs.container_id = c.id)
13. 0.015 0.015 ↑ 1.0 1 5

Index Scan using site_pkey on public.site s (cost=0.28..0.30 rows=1 width=100) (actual time=0.003..0.003 rows=1 loops=5)

  • Output: s.name, s.created_at, s.id, s.length, s.width, s.location_id, s.site_key, s.version, s.ship_type, s.discriminator, s.mmsi, s.call_sign
  • Index Cond: (s.id = cs.site_id)
14. 0.010 0.010 ↓ 0.0 0 5

Index Scan using pk_location on public.location sp (cost=0.43..8.15 rows=1 width=266) (actual time=0.002..0.002 rows=0 loops=5)

  • Output: sp.latitude, sp.region, sp.country, sp.address_line1, sp.state, sp.id, sp.address_line2, sp.location_name, sp.postal_code, sp.discriminator, sp.port_code, sp.longitude, sp.city, sp.time_zone_id
  • Index Cond: (s.location_id = sp.id)
15. 0.015 0.015 ↑ 1.0 1 5

Index Scan using pk_location on public.location dp (cost=0.43..8.45 rows=1 width=266) (actual time=0.002..0.003 rows=1 loops=5)

  • Output: dp.postal_code, dp.address_line2, dp.location_name, dp.id, dp.discriminator, dp.region, dp.country, dp.state, dp.port_code, dp.address_line1, dp.latitude, dp.city, dp.longitude, dp.time_zone_id
  • Index Cond: (sn.destination_port_id = dp.id)
16. 7.870 7.870 ↓ 1.3 1,870 5

Index Scan using site_status_site_id_first_time_ix on public.site_status ss (cost=0.43..146.15 rows=1,490 width=157) (actual time=0.004..1.574 rows=1,870 loops=5)

  • Output: ss.local_clock, ss.version, ss.location_id, ss.site_id, ss.lat, ss.names, ss.eta, ss.remote_clock, ss.lon, ss.discriminator, ss.draught, ss.last_time, ss.first_time, ss.id
  • Index Cond: (ss.site_id = s.id)
17. 0.000 0.000 ↓ 0.0 0 2,927

Index Scan using pk_location on public.location ssp (cost=0.43..0.72 rows=1 width=266) (actual time=0.000..0.000 rows=0 loops=2,927)

  • Output: ssp.latitude, ssp.address_line1, ssp.country, ssp.address_line2, ssp.state, ssp.longitude, ssp.region, ssp.id, ssp.port_code, ssp.location_name, ssp.city, ssp.discriminator, ssp.postal_code, ssp.time_zone_id
  • Index Cond: (ss.location_id = ssp.id)
18. 0.000 0.000 ↓ 0.0 0 2,927

Index Scan using pk_location on public.location op (cost=0.43..8.45 rows=1 width=266) (actual time=0.000..0.000 rows=0 loops=2,927)

  • Output: op.longitude, op.time_zone_id, op.address_line1, op.postal_code, op.region, op.country, op.city, op.latitude, op.state, op.id, op.address_line2, op.location_name, op.discriminator, op.port_code
  • Index Cond: (sn.origin_port_id = op.id)
19. 5.854 5.854 ↑ 1.0 1 2,927

Index Scan using pk_location on public.location lp (cost=0.43..8.45 rows=1 width=266) (actual time=0.002..0.002 rows=1 loops=2,927)

  • Output: lp.time_zone_id, lp.port_code, lp.id, lp.address_line1, lp.longitude, lp.city, lp.latitude, lp.state, lp.postal_code, lp.country, lp.address_line2, lp.location_name, lp.discriminator, lp.region
  • Index Cond: (sn.loading_port_id = lp.id)
Planning time : 2.624 ms
Execution time : 42.673 ms