explain.depesz.com

PostgreSQL's explain analyze made readable

Result: O4kc : Optimization for: Optimization for: Optimization for: plan #6fz; plan #Eo38; plan #Xu6

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 8.186 853.589 ↑ 1.0 1 1

Aggregate (cost=118,285.19..118,285.20 rows=1 width=0) (actual time=853.589..853.589 rows=1 loops=1)

2. 21.237 845.403 ↓ 62.4 21,075 1

Hash Left Join (cost=102,020.39..118,284.34 rows=338 width=0) (actual time=284.506..845.403 rows=21,075 loops=1)

  • Hash Cond: (booking_line.id_provider = provider.id)
3. 21.022 819.139 ↓ 62.4 21,075 1

Hash Left Join (cost=101,731.09..117,990.45 rows=338 width=4) (actual time=279.472..819.139 rows=21,075 loops=1)

  • Hash Cond: ((booking.id_assigned_to)::text = ("user".id)::text)
4. 19.497 796.703 ↓ 62.4 21,075 1

Hash Join (cost=101,659.35..117,914.05 rows=338 width=37) (actual time=278.047..796.703 rows=21,075 loops=1)

  • Hash Cond: (booking_line.id_pickup_zone = zone_translation.id_zone)
5. 27.355 775.640 ↓ 30.2 21,075 1

Nested Loop (cost=101,508.83..117,750.56 rows=698 width=41) (actual time=276.472..775.640 rows=21,075 loops=1)

6. 20.748 685.060 ↓ 30.2 21,075 1

Hash Join (cost=101,508.83..112,740.08 rows=698 width=45) (actual time=276.448..685.060 rows=21,075 loops=1)

  • Hash Cond: (booking.id_agent = agent.id)
7. 18.550 655.652 ↓ 30.2 21,075 1

Hash Left Join (cost=101,055.55..112,270.22 rows=698 width=49) (actual time=267.779..655.652 rows=21,075 loops=1)

  • Hash Cond: (booking.id_sales_agent = agent_1.id)
8. 39.478 628.485 ↓ 30.2 21,075 1

Nested Loop Left Join (cost=100,602.27..111,806.12 rows=698 width=53) (actual time=259.149..628.485 rows=21,075 loops=1)

9. 153.819 504.707 ↓ 30.2 21,075 1

Hash Join (cost=100,602.27..106,800.69 rows=698 width=57) (actual time=259.124..504.707 rows=21,075 loops=1)

  • Hash Cond: (booking_line_activity.id = booking_line.id_booking_line_activity)
10. 92.267 92.267 ↑ 1.0 229,123 1

Seq Scan on booking_line_activity (cost=0.00..5,332.23 rows=229,123 width=4) (actual time=0.006..92.267 rows=229,123 loops=1)

11. 13.356 258.621 ↓ 1.6 21,075 1

Hash (cost=100,440.53..100,440.53 rows=12,939 width=61) (actual time=258.621..258.621 rows=21,075 loops=1)

12. 40.239 245.265 ↓ 1.6 21,075 1

Nested Loop (cost=1.13..100,440.53 rows=12,939 width=61) (actual time=0.061..245.265 rows=21,075 loops=1)

13. 23.687 78.576 ↓ 1.7 21,075 1

Hash Join (cost=1.13..6,719.13 rows=12,623 width=53) (actual time=0.034..78.576 rows=21,075 loops=1)

  • Hash Cond: (booking.id_status = status_type.id)
14. 54.875 54.875 ↓ 1.0 25,551 1

Seq Scan on booking (cost=0.00..6,497.10 rows=25,246 width=57) (actual time=0.013..54.875 rows=25,551 loops=1)

  • Filter: ((deleted IS NULL) AND (id_owner = 917))
15. 0.005 0.014 ↓ 1.3 4 1

Hash (cost=1.09..1.09 rows=3 width=4) (actual time=0.014..0.014 rows=4 loops=1)

16. 0.009 0.009 ↓ 1.3 4 1

Seq Scan on status_type (cost=0.00..1.09 rows=3 width=4) (actual time=0.007..0.009 rows=4 loops=1)

  • Filter: (id = ANY ('{1,2,3,4}'::integer[]))
17. 126.450 126.450 ↑ 1.0 1 21,075

Index Scan using booking_line_id_booking_version_idx on booking_line (cost=0.00..7.41 rows=1 width=20) (actual time=0.006..0.006 rows=1 loops=21,075)

  • Index Cond: ((booking_line.id_booking = booking.id) AND (booking_line.version = booking.version))
18. 84.300 84.300 ↑ 1.0 1 21,075

Index Scan using booking_totals_pkey on booking_totals (cost=0.00..7.16 rows=1 width=4) (actual time=0.004..0.004 rows=1 loops=21,075)

  • Index Cond: (booking_totals.id_booking = booking.id)
19. 4.010 8.617 ↑ 1.0 9,168 1

Hash (cost=338.68..338.68 rows=9,168 width=4) (actual time=8.617..8.617 rows=9,168 loops=1)

20. 4.607 4.607 ↑ 1.0 9,168 1

Seq Scan on agent agent_1 (cost=0.00..338.68 rows=9,168 width=4) (actual time=0.006..4.607 rows=9,168 loops=1)

21. 4.021 8.660 ↑ 1.0 9,168 1

Hash (cost=338.68..338.68 rows=9,168 width=4) (actual time=8.660..8.660 rows=9,168 loops=1)

22. 4.639 4.639 ↑ 1.0 9,168 1

Seq Scan on agent (cost=0.00..338.68 rows=9,168 width=4) (actual time=0.007..4.639 rows=9,168 loops=1)

23. 63.225 63.225 ↑ 1.0 1 21,075

Index Scan using client_pkey on client (cost=0.00..7.17 rows=1 width=4) (actual time=0.002..0.003 rows=1 loops=21,075)

  • Index Cond: (client.id = booking.id_client)
24. 0.558 1.566 ↑ 1.0 1,260 1

Hash (cost=134.77..134.77 rows=1,260 width=4) (actual time=1.566..1.566 rows=1,260 loops=1)

25. 0.897 1.008 ↑ 1.0 1,260 1

Bitmap Heap Scan on zone_translation (cost=26.02..134.77 rows=1,260 width=4) (actual time=0.131..1.008 rows=1,260 loops=1)

  • Recheck Cond: (id_language = 1)
26. 0.111 0.111 ↑ 1.0 1,260 1

Bitmap Index Scan on zone_translations_id_language_idx (cost=0.00..25.70 rows=1,260 width=0) (actual time=0.111..0.111 rows=1,260 loops=1)

  • Index Cond: (id_language = 1)
27. 0.708 1.414 ↑ 1.0 1,411 1

Hash (cost=54.11..54.11 rows=1,411 width=36) (actual time=1.414..1.414 rows=1,411 loops=1)

28. 0.706 0.706 ↑ 1.0 1,411 1

Seq Scan on "user" (cost=0.00..54.11 rows=1,411 width=36) (actual time=0.008..0.706 rows=1,411 loops=1)

29. 2.317 5.027 ↑ 1.0 5,213 1

Hash (cost=224.13..224.13 rows=5,213 width=4) (actual time=5.027..5.027 rows=5,213 loops=1)

30. 2.710 2.710 ↑ 1.0 5,213 1

Seq Scan on provider (cost=0.00..224.13 rows=5,213 width=4) (actual time=0.007..2.710 rows=5,213 loops=1)