explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 7UII

Settings
# exclusive inclusive rows x rows loops node
1. 297.769 1,212.638 ↑ 2.0 23,430 1

Hash Right Join (cost=95,481.65..3,665,205.54 rows=46,895 width=173) (actual time=282.273..1,212.638 rows=23,430 loops=1)

  • Hash Cond: (slip_line_items.slip_id = slips.id)
2. 164.480 164.480 ↑ 1.0 663,806 1

Seq Scan on slip_line_items (cost=0.00..15,599.06 rows=663,806 width=27) (actual time=0.014..164.480 rows=663,806 loops=1)

3. 15.782 281.789 ↑ 2.0 23,430 1

Hash (cost=94,345.47..94,345.47 rows=46,895 width=70) (actual time=281.789..281.789 rows=23,430 loops=1)

  • Buckets: 65,536 Batches: 2 Memory Usage: 1,429kB
4. 245.505 266.007 ↑ 2.0 23,430 1

Bitmap Heap Scan on slips (cost=1,773.42..94,345.47 rows=46,895 width=70) (actual time=36.368..266.007 rows=23,430 loops=1)

  • Recheck Cond: (customer_id = 33)
  • Filter: (created_at > (CURRENT_DATE - 30))
  • Rows Removed by Filter: 71,096
  • Heap Blocks: exact=37,795
5. 20.502 20.502 ↑ 1.0 94,526 1

Bitmap Index Scan on index_slips_on_customer_id (cost=0.00..1,761.70 rows=95,103 width=0) (actual time=20.502..20.502 rows=94,526 loops=1)

  • Index Cond: (customer_id = 33)
6.          

SubPlan (for Hash Right Join)

7. 0.000 23.430 ↓ 0.0 0 23,430

Limit (cost=0.28..8.30 rows=1 width=25) (actual time=0.001..0.001 rows=0 loops=23,430)

8. 23.430 23.430 ↓ 0.0 0 23,430

Index Scan using job_sites_pkey on job_sites (cost=0.28..8.30 rows=1 width=25) (actual time=0.001..0.001 rows=0 loops=23,430)

  • Index Cond: (id = slips.job_site_id)
9. 0.000 187.440 ↑ 1.0 1 23,430

Limit (cost=0.72..33.50 rows=1 width=11) (actual time=0.008..0.008 rows=1 loops=23,430)

10. 28.425 187.440 ↑ 1.0 1 23,430

Nested Loop (cost=0.72..33.50 rows=1 width=11) (actual time=0.008..0.008 rows=1 loops=23,430)

11. 93.720 93.720 ↑ 3.0 1 23,430

Index Scan using index_customer_external_entity_slips_on_slip_id on customer_external_entity_slips slip_entities (cost=0.43..8.55 rows=3 width=8) (actual time=0.004..0.004 rows=1 loops=23,430)

  • Index Cond: (slip_id = slips.id)
12. 65.295 65.295 ↑ 1.0 1 21,765

Index Scan using customer_external_entities_pkey on customer_external_entities (cost=0.29..8.31 rows=1 width=19) (actual time=0.003..0.003 rows=1 loops=21,765)

  • Index Cond: (id = slip_entities.customer_external_entity_id)
  • Filter: (((external_type)::text = 'CustomerExternalEntity::ExternalTruck'::text) AND (customer_id = slips.customer_id))
  • Rows Removed by Filter: 0
13. 0.000 257.730 ↑ 1.0 1 23,430

Limit (cost=0.72..33.74 rows=1 width=11) (actual time=0.011..0.011 rows=1 loops=23,430)

14. 16.380 257.730 ↑ 1.0 1 23,430

Nested Loop (cost=0.72..33.74 rows=1 width=11) (actual time=0.011..0.011 rows=1 loops=23,430)

15. 93.720 93.720 ↑ 1.5 2 23,430

Index Scan using index_customer_external_entity_slips_on_slip_id on customer_external_entity_slips slip_entities_1 (cost=0.43..8.55 rows=3 width=8) (actual time=0.003..0.004 rows=2 loops=23,430)

  • Index Cond: (slip_id = slips.id)
16. 147.630 147.630 ↓ 0.0 0 49,210

Index Scan using customer_external_entities_pkey on customer_external_entities customer_external_entities_1 (cost=0.29..8.31 rows=1 width=19) (actual time=0.003..0.003 rows=0 loops=49,210)

  • Index Cond: (id = slip_entities_1.customer_external_entity_id)
  • Filter: (((external_type)::text = 'CustomerExternalEntity::ExternalFleet'::text) AND (customer_id = slips.customer_id))
  • Rows Removed by Filter: 1
Planning time : 1.423 ms
Execution time : 1,214.894 ms