explain.depesz.com

PostgreSQL's explain analyze made readable

Result: vJdy

Settings
# exclusive inclusive rows x rows loops node
1. 0.252 7,808.818 ↓ 2.3 160 1

Nested Loop Left Join (cost=3.56..4,283.36 rows=71 width=2,052) (actual time=7,380.803..7,808.818 rows=160 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. 0.249 7,808.566 ↓ 2.3 160 1

Nested Loop Left Join (cost=3.13..3,682.87 rows=71 width=1,786) (actual time=7,380.799..7,808.566 rows=160 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. 0.324 7,808.317 ↓ 2.3 160 1

Nested Loop Left Join (cost=2.70..3,082.39 rows=71 width=1,520) (actual time=7,380.793..7,808.317 rows=160 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. 1.954 7,807.993 ↓ 2.3 160 1

Nested Loop Left Join (cost=2.27..3,030.51 rows=71 width=1,254) (actual time=7,380.767..7,807.993 rows=160 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: 4322
5. 0.007 21.363 ↓ 2.0 2 1

Nested Loop Left Join (cost=1.84..2,854.56 rows=1 width=1,097) (actual time=21.059..21.363 rows=2 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.006 21.336 ↓ 2.0 2 1

Nested Loop Left Join (cost=1.42..2,846.11 rows=1 width=831) (actual time=21.046..21.336 rows=2 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.004 21.328 ↓ 2.0 2 1

Nested Loop Left Join (cost=0.99..2,837.95 rows=1 width=565) (actual time=21.042..21.328 rows=2 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.019 20.858 ↓ 2.0 2 1

Nested Loop Left Join (cost=0.71..2,837.64 rows=1 width=465) (actual time=20.586..20.858 rows=2 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.006 15.741 ↑ 1.0 1 1

Nested Loop (cost=0.29..2,835.80 rows=1 width=237) (actual time=15.479..15.741 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.594 13.594 ↑ 1.0 1 1

Seq Scan on public.tracking_session sn (cost=0.00..2,827.48 rows=1 width=201) (actual time=13.335..13.594 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 = 'dfd86a30-db4f-462f-ae81-281b3a8f7255'::uuid))
  • Rows Removed by Filter: 64033
11. 2.141 2.141 ↑ 1.0 1 1

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

  • Output: c.created_at, c.id, c.container_number
  • Index Cond: (c.id = sn.trackable_id)
12. 5.098 5.098 ↑ 4.5 2 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=5.095..5.098 rows=2 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.466 0.466 ↑ 1.0 1 2

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

  • 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.002 0.002 ↓ 0.0 0 2

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

  • 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.020 0.020 ↑ 1.0 1 2

Index Scan using pk_location on public.location dp (cost=0.43..8.45 rows=1 width=266) (actual time=0.009..0.010 rows=1 loops=2)

  • 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,784.676 7,784.676 ↓ 1.5 2,241 2

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=1.035..3,892.338 rows=2,241 loops=2)

  • 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 160

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=160)

  • 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 160

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=160)

  • 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. 0.000 0.000 ↓ 0.0 0 160

Index Scan using pk_location on public.location lp (cost=0.43..8.45 rows=1 width=266) (actual time=0.000..0.000 rows=0 loops=160)

  • 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 : 1.493 ms
Execution time : 7,809.193 ms