explain.depesz.com

PostgreSQL's explain analyze made readable

Result: PRQ2

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=10,263.19..493,326.87 rows=51,495 width=8,944) (actual rows= loops=)

  • Hash Cond: (t.user_id = sumdu.id)
2. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=10,149.92..39,703.83 rows=51,495 width=7,916) (actual rows= loops=)

  • Hash Cond: (o.doc_user = docu.id)
3. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=10,036.65..39,397.44 rows=51,495 width=6,888) (actual rows= loops=)

  • Hash Cond: (sh.user_id = sumu.id)
4. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=9,923.38..38,809.39 rows=51,495 width=5,860) (actual rows= loops=)

  • Hash Cond: (o.scheduled_by = schu.id)
5. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=9,810.10..38,329.16 rows=51,495 width=4,832) (actual rows= loops=)

  • Hash Cond: (o.approved_by_user = appu.id)
6. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=9,693.73..37,524.25 rows=51,495 width=4,316) (actual rows= loops=)

  • Hash Cond: (o.imp_user_id = impu.id)
7. 0.000 0.000 ↓ 0.0

Nested Loop Left Join (cost=9,577.35..36,699.81 rows=51,495 width=3,800) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=9,577.06..16,514.15 rows=51,495 width=3,723) (actual rows= loops=)

  • Hash Cond: ((o.event_code)::integer = e.id)
9. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=9,572.36..15,878.64 rows=51,495 width=3,636) (actual rows= loops=)

  • Hash Cond: (o.id = t.order_id)
10. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=2,434.55..8,224.88 rows=51,495 width=3,611) (actual rows= loops=)

  • Hash Cond: (o.client_id = cli.id)
11. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=469.32..5,036.65 rows=51,495 width=3,571) (actual rows= loops=)

  • Hash Cond: (o.courier_id = c.id)
12. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=463.69..4,683.72 rows=51,495 width=3,554) (actual rows= loops=)

  • Hash Cond: (o.mobile_user_id = mu.id)
13. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=347.31..4,219.45 rows=51,495 width=3,038) (actual rows= loops=)

  • Hash Cond: (o.agent_id = a.id)
14. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=346.02..3,510.10 rows=51,495 width=3,021) (actual rows= loops=)

  • Hash Cond: (o.adviser_user_id = aa.id)
15. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=229.65..3,200.61 rows=51,495 width=2,505) (actual rows= loops=)

  • Hash Cond: (o.user_id = u.id)
16. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=113.27..2,891.12 rows=51,495 width=1,989) (actual rows= loops=)

  • Hash Cond: (o.assignor_user_id = assignor.id)
17. 0.000 0.000 ↓ 0.0

Seq Scan on orders o (cost=0.00..2,429.95 rows=51,495 width=957) (actual rows= loops=)

18. 0.000 0.000 ↓ 0.0

Hash (cost=112.31..112.31 rows=77 width=1,036) (actual rows= loops=)

19. 0.000 0.000 ↓ 0.0

Foreign Scan on users assignor (cost=100.00..112.31 rows=77 width=1,036) (actual rows= loops=)

20. 0.000 0.000 ↓ 0.0

Hash (cost=114.50..114.50 rows=150 width=520) (actual rows= loops=)

21. 0.000 0.000 ↓ 0.0

Foreign Scan on users u (cost=100.00..114.50 rows=150 width=520) (actual rows= loops=)

22. 0.000 0.000 ↓ 0.0

Hash (cost=114.50..114.50 rows=150 width=520) (actual rows= loops=)

23. 0.000 0.000 ↓ 0.0

Foreign Scan on users aa (cost=100.00..114.50 rows=150 width=520) (actual rows= loops=)

24. 0.000 0.000 ↓ 0.0

Hash (cost=1.13..1.13 rows=13 width=21) (actual rows= loops=)

25. 0.000 0.000 ↓ 0.0

Seq Scan on agents a (cost=0.00..1.13 rows=13 width=21) (actual rows= loops=)

26. 0.000 0.000 ↓ 0.0

Hash (cost=114.50..114.50 rows=150 width=520) (actual rows= loops=)

27. 0.000 0.000 ↓ 0.0

Foreign Scan on mobile_users mu (cost=100.00..114.50 rows=150 width=520) (actual rows= loops=)

28. 0.000 0.000 ↓ 0.0

Hash (cost=4.17..4.17 rows=117 width=21) (actual rows= loops=)

29. 0.000 0.000 ↓ 0.0

Seq Scan on couriers c (cost=0.00..4.17 rows=117 width=21) (actual rows= loops=)

30. 0.000 0.000 ↓ 0.0

Hash (cost=1,511.21..1,511.21 rows=36,321 width=44) (actual rows= loops=)

31. 0.000 0.000 ↓ 0.0

Seq Scan on clients cli (cost=0.00..1,511.21 rows=36,321 width=44) (actual rows= loops=)

32. 0.000 0.000 ↓ 0.0

Hash (cost=7,136.58..7,136.58 rows=99 width=29) (actual rows= loops=)

33. 0.000 0.000 ↓ 0.0

Hash Left Join (cost=6,492.47..7,136.58 rows=99 width=29) (actual rows= loops=)

  • Hash Cond: (t.summary_header_id = sh.id)
34. 0.000 0.000 ↓ 0.0

Subquery Scan on t (cost=6,441.01..7,083.76 rows=99 width=21) (actual rows= loops=)

  • Filter: (t.row_number = 1)
35. 0.000 0.000 ↓ 0.0

WindowAgg (cost=6,441.01..6,836.55 rows=19,777 width=100) (actual rows= loops=)

36. 0.000 0.000 ↓ 0.0

Sort (cost=6,441.01..6,490.45 rows=19,777 width=100) (actual rows= loops=)

  • Sort Key: summary_details.order_id, summary_details.created_at
37. 0.000 0.000 ↓ 0.0

Seq Scan on summary_details (cost=0.00..5,029.77 rows=19,777 width=100) (actual rows= loops=)

38. 0.000 0.000 ↓ 0.0

Hash (cost=32.87..32.87 rows=1,487 width=16) (actual rows= loops=)

39. 0.000 0.000 ↓ 0.0

Seq Scan on summary_header sh (cost=0.00..32.87 rows=1,487 width=16) (actual rows= loops=)

40. 0.000 0.000 ↓ 0.0

Hash (cost=3.20..3.20 rows=120 width=91) (actual rows= loops=)

41. 0.000 0.000 ↓ 0.0

Seq Scan on events e (cost=0.00..3.20 rows=120 width=91) (actual rows= loops=)

42. 0.000 0.000 ↓ 0.0

Index Scan using client_addresses_pkey on client_addresses ca (cost=0.29..0.38 rows=1 width=81) (actual rows= loops=)

  • Index Cond: (id = o.client_address_id)
43. 0.000 0.000 ↓ 0.0

Hash (cost=114.50..114.50 rows=150 width=520) (actual rows= loops=)

44. 0.000 0.000 ↓ 0.0

Foreign Scan on users impu (cost=100.00..114.50 rows=150 width=520) (actual rows= loops=)

45. 0.000 0.000 ↓ 0.0

Hash (cost=114.50..114.50 rows=150 width=520) (actual rows= loops=)

46. 0.000 0.000 ↓ 0.0

Foreign Scan on users appu (cost=100.00..114.50 rows=150 width=520) (actual rows= loops=)

47. 0.000 0.000 ↓ 0.0

Hash (cost=112.31..112.31 rows=77 width=1,036) (actual rows= loops=)

48. 0.000 0.000 ↓ 0.0

Foreign Scan on users schu (cost=100.00..112.31 rows=77 width=1,036) (actual rows= loops=)

49. 0.000 0.000 ↓ 0.0

Hash (cost=112.31..112.31 rows=77 width=1,036) (actual rows= loops=)

50. 0.000 0.000 ↓ 0.0

Foreign Scan on users sumu (cost=100.00..112.31 rows=77 width=1,036) (actual rows= loops=)

51. 0.000 0.000 ↓ 0.0

Hash (cost=112.31..112.31 rows=77 width=1,036) (actual rows= loops=)

52. 0.000 0.000 ↓ 0.0

Foreign Scan on users docu (cost=100.00..112.31 rows=77 width=1,036) (actual rows= loops=)

53. 0.000 0.000 ↓ 0.0

Hash (cost=112.31..112.31 rows=77 width=1,036) (actual rows= loops=)

54. 0.000 0.000 ↓ 0.0

Foreign Scan on users sumdu (cost=100.00..112.31 rows=77 width=1,036) (actual rows= loops=)

55.          

SubPlan (for Hash Left Join)

56. 0.000 0.000 ↓ 0.0

Aggregate (cost=8.73..8.74 rows=1 width=4) (actual rows= loops=)

57. 0.000 0.000 ↓ 0.0

Index Scan using products_order_id_idx on products (cost=0.29..8.73 rows=2 width=4) (actual rows= loops=)

  • Index Cond: (order_id = o.id)