explain.depesz.com

PostgreSQL's explain analyze made readable

Result: zlCK

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 0.870 ↑ 48.5 4 1

Unique (cost=171.45..173.39 rows=194 width=30) (actual time=0.868..0.870 rows=4 loops=1)

2. 0.037 0.868 ↑ 48.5 4 1

Sort (cost=171.45..171.94 rows=194 width=30) (actual time=0.868..0.868 rows=4 loops=1)

  • Sort Key: (min(CASE WHEN ((pl.product_line_id)::text = ANY ('{106032,636,637}'::text[])) THEN 1 ELSE 2 END)), bth.booking_template_id, bth.name
  • Sort Method: quicksort Memory: 25kB
3. 0.043 0.831 ↑ 48.5 4 1

HashAggregate (cost=162.14..164.08 rows=194 width=30) (actual time=0.831..0.831 rows=4 loops=1)

  • Group Key: bth.booking_template_id, bth.name
4. 0.040 0.788 ↑ 2.8 70 1

Nested Loop (cost=45.96..159.96 rows=194 width=33) (actual time=0.526..0.788 rows=70 loops=1)

5. 0.013 0.678 ↑ 2.8 70 1

Nested Loop (cost=45.67..97.50 rows=194 width=30) (actual time=0.517..0.678 rows=70 loops=1)

6. 0.133 0.637 ↑ 2.8 4 1

Hash Join (cost=45.39..82.20 rows=11 width=34) (actual time=0.507..0.637 rows=4 loops=1)

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

Seq Scan on inspections_bookingtemplatehistory bth (cost=0.00..32.42 rows=1,142 width=30) (actual time=0.009..0.099 rows=1,148 loops=1)

8. 0.010 0.405 ↑ 2.8 4 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
9. 0.003 0.395 ↑ 2.8 4 1

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

  • Group Key: "ANY_subquery".id
10. 0.002 0.392 ↑ 2.8 4 1

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

11. 0.006 0.390 ↑ 2.8 4 1

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

  • Group Key: bth_1.booking_template_id
12. 0.021 0.384 ↓ 1.9 21 1

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

  • Sort Key: bth_1.booking_template_id
  • Sort Method: quicksort Memory: 25kB
13. 0.101 0.363 ↓ 1.9 21 1

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

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

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

  • Filter: (booking_form IS NOT NULL)
  • Rows Removed by Filter: 276
15. 0.008 0.060 ↑ 1.0 4 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
16. 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.022..0.052 rows=4 loops=1)

  • Filter: (org_id = 252437)
  • Rows Removed by Filter: 313
17. 0.028 0.028 ↑ 1.1 18 4

Index Scan using inspections_bookingtemplat_bookingtemplatehistory_id_ff2c0fe0 on inspections_bookingtemplatehistory_product_lines bpl (cost=0.29..1.20 rows=19 width=8) (actual time=0.005..0.007 rows=18 loops=4)

  • Index Cond: (bookingtemplatehistory_id = bth.id)
18. 0.070 0.070 ↑ 1.0 1 70

Index Scan using datasource_productline_pkey on datasource_productline pl (cost=0.28..0.31 rows=1 width=11) (actual time=0.001..0.001 rows=1 loops=70)

  • Index Cond: (id = bpl.productline_id)
Planning time : 0.853 ms
Execution time : 0.948 ms