explain.depesz.com

PostgreSQL's explain analyze made readable

Result: UTSD

Settings
# exclusive inclusive rows x rows loops node
1. 0.003 1.677 ↑ 165.5 4 1

Unique (cost=342.48..349.10 rows=662 width=42) (actual time=1.676..1.677 rows=4 loops=1)

2. 0.017 1.674 ↑ 165.5 4 1

Sort (cost=342.48..344.14 rows=662 width=42) (actual time=1.674..1.674 rows=4 loops=1)

  • Sort Key: (min(CASE WHEN (((pl.product_line_id)::text = ANY ('{106032,636,637}'::text[])) AND ((it.code)::text = 'DUPRO'::text)) THEN 1 ELSE 2 END)), bth.name, bth.uuid
  • Sort Method: quicksort Memory: 25kB
3. 0.059 1.657 ↑ 165.5 4 1

HashAggregate (cost=304.84..311.46 rows=662 width=42) (actual time=1.654..1.657 rows=4 loops=1)

  • Group Key: bth.uuid, bth.name
4. 0.430 1.598 ↑ 7.0 94 1

Hash Join (cost=148.35..295.74 rows=662 width=52) (actual time=0.896..1.598 rows=94 loops=1)

  • Hash Cond: (pl.id = bpl.productline_id)
5. 0.447 0.447 ↑ 1.0 4,554 1

Seq Scan on datasource_productline pl (cost=0.00..89.54 rows=4,554 width=11) (actual time=0.009..0.447 rows=4,554 loops=1)

6. 0.026 0.721 ↑ 7.0 94 1

Hash (cost=140.07..140.07 rows=662 width=49) (actual time=0.721..0.721 rows=94 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 19kB
7. 0.023 0.695 ↑ 7.0 94 1

Nested Loop (cost=46.23..140.07 rows=662 width=49) (actual time=0.502..0.695 rows=94 loops=1)

  • Join Filter: (bth.id = bpl.bookingtemplatehistory_id)
8. 0.002 0.636 ↑ 6.3 6 1

Nested Loop (cost=45.95..101.01 rows=38 width=57) (actual time=0.489..0.636 rows=6 loops=1)

9. 0.002 0.616 ↑ 6.3 6 1

Nested Loop (cost=45.67..87.54 rows=38 width=54) (actual time=0.482..0.616 rows=6 loops=1)

10. 0.134 0.598 ↑ 2.8 4 1

Hash Join (cost=45.39..82.20 rows=11 width=46) (actual time=0.473..0.598 rows=4 loops=1)

  • Hash Cond: (bth.id = "ANY_subquery".id)
11. 0.094 0.094 ↓ 1.0 1,148 1

Seq Scan on inspections_bookingtemplatehistory bth (cost=0.00..32.42 rows=1,142 width=42) (actual time=0.005..0.094 rows=1,148 loops=1)

12. 0.006 0.370 ↑ 2.8 4 1

Hash (cost=45.25..45.25 rows=11 width=4) (actual time=0.370..0.370 rows=4 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
13. 0.004 0.364 ↑ 2.8 4 1

HashAggregate (cost=45.14..45.25 rows=11 width=4) (actual time=0.364..0.364 rows=4 loops=1)

  • Group Key: "ANY_subquery".id
14. 0.001 0.360 ↑ 2.8 4 1

Subquery Scan on ANY_subquery (cost=44.81..45.11 rows=11 width=4) (actual time=0.355..0.360 rows=4 loops=1)

15. 0.005 0.359 ↑ 2.8 4 1

GroupAggregate (cost=44.81..45.00 rows=11 width=8) (actual time=0.355..0.359 rows=4 loops=1)

  • Group Key: bth_1.booking_template_id
16. 0.017 0.354 ↓ 1.9 21 1

Sort (cost=44.81..44.84 rows=11 width=8) (actual time=0.351..0.354 rows=21 loops=1)

  • Sort Key: bth_1.booking_template_id
  • Sort Method: quicksort Memory: 25kB
17. 0.076 0.337 ↓ 1.9 21 1

Hash Join (cost=8.84..44.62 rows=11 width=8) (actual time=0.081..0.337 rows=21 loops=1)

  • Hash Cond: (bth_1.booking_template_id = bt.id)
18. 0.205 0.205 ↓ 1.0 872 1

Seq Scan on inspections_bookingtemplatehistory bth_1 (cost=0.00..32.42 rows=867 width=8) (actual time=0.003..0.205 rows=872 loops=1)

  • Filter: (booking_form IS NOT NULL)
  • Rows Removed by Filter: 276
19. 0.004 0.056 ↑ 1.0 4 1

Hash (cost=8.79..8.79 rows=4 width=4) (actual time=0.056..0.056 rows=4 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
20. 0.052 0.052 ↑ 1.0 4 1

Seq Scan on inspections_bookingtemplate bt (cost=0.00..8.79 rows=4 width=4) (actual time=0.020..0.052 rows=4 loops=1)

  • Filter: (org_id = 252437)
  • Rows Removed by Filter: 313
21. 0.016 0.016 ↑ 1.5 2 4

Index Scan using inspections_bookingtemplat_bookingtemplatehistory_id_a6adbd7e on inspections_bookingtemplatehistory_inspection_types "bit" (cost=0.28..0.46 rows=3 width=8) (actual time=0.004..0.004 rows=2 loops=4)

  • Index Cond: (bookingtemplatehistory_id = bth.id)
22. 0.018 0.018 ↑ 1.0 1 6

Index Scan using inspections_inspectiontype_pkey on inspections_inspectiontype it (cost=0.28..0.34 rows=1 width=11) (actual time=0.003..0.003 rows=1 loops=6)

  • Index Cond: (id = "bit".inspectiontype_id)
23. 0.036 0.036 ↑ 1.2 16 6

Index Scan using inspections_bookingtemplat_bookingtemplatehistory_id_ff2c0fe0 on inspections_bookingtemplatehistory_product_lines bpl (cost=0.29..0.79 rows=19 width=8) (actual time=0.004..0.006 rows=16 loops=6)

  • Index Cond: (bookingtemplatehistory_id = "bit".bookingtemplatehistory_id)
Planning time : 2.705 ms
Execution time : 1.898 ms