explain.depesz.com

PostgreSQL's explain analyze made readable

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

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 8.210 857.732 ↑ 1.0 1 1

Aggregate (cost=117,250.37..117,250.38 rows=1 width=0) (actual time=857.732..857.732 rows=1 loops=1)

2. 22.608 849.522 ↓ 64.8 21,075 1

Hash Left Join (cost=101,317.32..117,249.56 rows=325 width=0) (actual time=276.776..849.522 rows=21,075 loops=1)

  • Hash Cond: (booking_line.id_provider = provider.id)
3. 21.979 821.819 ↓ 64.8 21,075 1

Hash Left Join (cost=101,028.02..116,955.86 rows=325 width=4) (actual time=271.672..821.819 rows=21,075 loops=1)

  • Hash Cond: ((booking.id_assigned_to)::text = ("user".id)::text)
4. 20.088 798.380 ↓ 64.8 21,075 1

Hash Join (cost=100,956.28..116,879.64 rows=325 width=37) (actual time=270.201..798.380 rows=21,075 loops=1)

  • Hash Cond: (booking_line.id_pickup_zone = zone_translation.id_zone)
5. 28.515 776.649 ↓ 31.2 21,075 1

Nested Loop (cost=100,805.76..116,716.60 rows=675 width=41) (actual time=268.549..776.649 rows=21,075 loops=1)

6. 21.917 684.909 ↓ 31.2 21,075 1

Hash Join (cost=100,805.76..111,871.04 rows=675 width=45) (actual time=268.522..684.909 rows=21,075 loops=1)

  • Hash Cond: (booking.id_agent = agent.id)
7. 19.503 654.349 ↓ 31.2 21,075 1

Hash Left Join (cost=100,352.48..111,401.73 rows=675 width=49) (actual time=259.869..654.349 rows=21,075 loops=1)

  • Hash Cond: (booking.id_sales_agent = agent_1.id)
8. 40.765 625.847 ↓ 31.2 21,075 1

Nested Loop Left Join (cost=99,899.20..110,938.00 rows=675 width=53) (actual time=250.857..625.847 rows=21,075 loops=1)

9. 156.595 500.782 ↓ 31.2 21,075 1

Hash Join (cost=99,899.20..106,097.39 rows=675 width=57) (actual time=250.831..500.782 rows=21,075 loops=1)

  • Hash Cond: (booking_line_activity.id = booking_line.id_booking_line_activity)
10. 93.872 93.872 ↑ 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.007..93.872 rows=229,123 loops=1)

11. 13.229 250.315 ↓ 1.7 21,075 1

Hash (cost=99,741.08..99,741.08 rows=12,650 width=61) (actual time=250.315..250.315 rows=21,075 loops=1)

12. 34.729 237.086 ↓ 1.7 21,075 1

Nested Loop (cost=1.13..99,741.08 rows=12,650 width=61) (actual time=0.056..237.086 rows=21,075 loops=1)

13. 23.124 75.907 ↓ 1.7 21,075 1

Hash Join (cost=1.13..6,717.45 rows=12,527 width=53) (actual time=0.031..75.907 rows=21,075 loops=1)

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

Seq Scan on booking (cost=0.00..6,497.10 rows=25,054 width=57) (actual time=0.012..52.770 rows=25,551 loops=1)

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

Hash (cost=1.09..1.09 rows=3 width=4) (actual time=0.013..0.013 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.008..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.005..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.210 8.999 ↑ 1.0 9,168 1

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

20. 4.789 4.789 ↑ 1.0 9,168 1

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

21. 4.058 8.643 ↑ 1.0 9,168 1

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

22. 4.585 4.585 ↑ 1.0 9,168 1

Seq Scan on agent (cost=0.00..338.68 rows=9,168 width=4) (actual time=0.006..4.585 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.563 1.643 ↑ 1.0 1,260 1

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

25. 0.971 1.080 ↑ 1.0 1,260 1

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

  • Recheck Cond: (id_language = 1)
26. 0.109 0.109 ↑ 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.109..0.109 rows=1,260 loops=1)

  • Index Cond: (id_language = 1)
27. 0.681 1.460 ↑ 1.0 1,411 1

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

28. 0.779 0.779 ↑ 1.0 1,411 1

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

29. 2.355 5.095 ↑ 1.0 5,213 1

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

30. 2.740 2.740 ↑ 1.0 5,213 1

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