explain.depesz.com

PostgreSQL's explain analyze made readable

Result: daZO

Settings
# exclusive inclusive rows x rows loops node
1. 243.399 5,454.156 ↑ 1.0 51,495 1

Hash Left Join (cost=10,263.19..493,326.87 rows=51,495 width=8,944) (actual time=2,271.410..5,454.156 rows=51,495 loops=1)

  • Hash Cond: (t.user_id = sumdu.id)
2. 91.385 4,481.663 ↑ 1.0 51,495 1

Hash Left Join (cost=10,149.92..39,703.83 rows=51,495 width=7,916) (actual time=2,263.171..4,481.663 rows=51,495 loops=1)

  • Hash Cond: (o.doc_user = docu.id)
3. 84.770 4,382.248 ↑ 1.0 51,495 1

Hash Left Join (cost=10,036.65..39,397.44 rows=51,495 width=6,888) (actual time=2,255.128..4,382.248 rows=51,495 loops=1)

  • Hash Cond: (sh.user_id = sumu.id)
4. 89.706 4,289.219 ↑ 1.0 51,495 1

Hash Left Join (cost=9,923.38..38,809.39 rows=51,495 width=5,860) (actual time=2,246.854..4,289.219 rows=51,495 loops=1)

  • Hash Cond: (o.scheduled_by = schu.id)
5. 94.179 4,191.231 ↑ 1.0 51,495 1

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

  • Hash Cond: (o.approved_by_user = appu.id)
6. 101.972 4,090.006 ↑ 1.0 51,495 1

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

  • Hash Cond: (o.imp_user_id = impu.id)
7. 163.626 3,980.819 ↑ 1.0 51,495 1

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

8. 106.982 3,456.728 ↑ 1.0 51,495 1

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

  • Hash Cond: ((o.event_code)::integer = e.id)
9. 188.486 3,349.609 ↑ 1.0 51,495 1

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

  • Hash Cond: (o.id = t.order_id)
10. 165.336 2,878.750 ↑ 1.0 51,495 1

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

  • Hash Cond: (o.client_id = cli.id)
11. 86.069 2,645.370 ↑ 1.0 51,495 1

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

  • Hash Cond: (o.courier_id = c.id)
12. 282.048 2,559.046 ↑ 1.0 51,495 1

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

  • Hash Cond: (o.mobile_user_id = mu.id)
13. 87.841 427.936 ↑ 1.0 51,495 1

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

  • Hash Cond: (o.agent_id = a.id)
14. 79.446 340.063 ↑ 1.0 51,495 1

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

  • Hash Cond: (o.adviser_user_id = aa.id)
15. 78.372 253.833 ↑ 1.0 51,495 1

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

  • Hash Cond: (o.user_id = u.id)
16. 116.002 168.562 ↑ 1.0 51,495 1

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

  • Hash Cond: (o.assignor_user_id = assignor.id)
17. 44.084 44.084 ↑ 1.0 51,495 1

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

18. 1.624 8.476 ↓ 22.5 1,732 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 120kB
19. 6.852 6.852 ↓ 22.5 1,732 1

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

20. 1.435 6.899 ↓ 11.5 1,732 1

Hash (cost=114.50..114.50 rows=150 width=520) (actual time=6.899..6.899 rows=1,732 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 83kB
21. 5.464 5.464 ↓ 11.5 1,732 1

Foreign Scan on users u (cost=100.00..114.50 rows=150 width=520) (actual time=0.436..5.464 rows=1,732 loops=1)

22. 1.480 6.784 ↓ 11.5 1,732 1

Hash (cost=114.50..114.50 rows=150 width=520) (actual time=6.784..6.784 rows=1,732 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 83kB
23. 5.304 5.304 ↓ 11.5 1,732 1

Foreign Scan on users aa (cost=100.00..114.50 rows=150 width=520) (actual time=0.442..5.304 rows=1,732 loops=1)

24. 0.013 0.032 ↓ 1.2 16 1

Hash (cost=1.13..1.13 rows=13 width=21) (actual time=0.032..0.032 rows=16 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 1kB
25. 0.019 0.019 ↓ 1.2 16 1

Seq Scan on agents a (cost=0.00..1.13 rows=13 width=21) (actual time=0.007..0.019 rows=16 loops=1)

26. 420.600 1,849.062 ↓ 2,816.2 422,430 1

Hash (cost=114.50..114.50 rows=150 width=520) (actual time=1,849.062..1,849.062 rows=422,430 loops=1)

  • Buckets: 1,024 Batches: 8 (originally 1) Memory Usage: 4,097kB
27. 1,428.462 1,428.462 ↓ 2,816.2 422,430 1

Foreign Scan on mobile_users mu (cost=100.00..114.50 rows=150 width=520) (actual time=0.566..1,428.462 rows=422,430 loops=1)

28. 0.133 0.255 ↑ 1.0 117 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 7kB
29. 0.122 0.122 ↑ 1.0 117 1

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

30. 33.500 68.044 ↑ 1.0 35,651 1

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

  • Buckets: 4,096 Batches: 1 Memory Usage: 2,755kB
31. 34.544 34.544 ↑ 1.0 35,651 1

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

32. 17.079 282.373 ↓ 181.1 17,927 1

Hash (cost=7,136.58..7,136.58 rows=99 width=29) (actual time=282.373..282.373 rows=17,927 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 883kB
33. 27.422 265.294 ↓ 181.1 17,927 1

Hash Left Join (cost=6,492.47..7,136.58 rows=99 width=29) (actual time=137.739..265.294 rows=17,927 loops=1)

  • Hash Cond: (t.summary_header_id = sh.id)
34. 24.408 235.437 ↓ 181.1 17,927 1

Subquery Scan on t (cost=6,441.01..7,083.76 rows=99 width=21) (actual time=135.273..235.437 rows=17,927 loops=1)

  • Filter: (t.row_number = 1)
  • Rows Removed by Filter: 1,850
35. 43.066 211.029 ↑ 1.0 19,777 1

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

36. 124.780 167.963 ↑ 1.0 19,777 1

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

  • Sort Key: summary_details.order_id, summary_details.created_at
  • Sort Method: external merge Disk: 31,664kB
37. 43.183 43.183 ↑ 1.0 19,777 1

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

38. 1.226 2.435 ↓ 1.0 1,503 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 62kB
39. 1.209 1.209 ↓ 1.0 1,503 1

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

40. 0.070 0.137 ↑ 1.8 66 1

Hash (cost=3.20..3.20 rows=120 width=91) (actual time=0.137..0.137 rows=66 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 8kB
41. 0.067 0.067 ↑ 1.8 66 1

Seq Scan on events e (cost=0.00..3.20 rows=120 width=91) (actual time=0.013..0.067 rows=66 loops=1)

42. 360.465 360.465 ↑ 1.0 1 51,495

Index Scan using client_addresses_pkey on client_addresses ca (cost=0.29..0.38 rows=1 width=81) (actual time=0.006..0.007 rows=1 loops=51,495)

  • Index Cond: (id = o.client_address_id)
43. 1.571 7.215 ↓ 11.5 1,732 1

Hash (cost=114.50..114.50 rows=150 width=520) (actual time=7.215..7.215 rows=1,732 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 83kB
44. 5.644 5.644 ↓ 11.5 1,732 1

Foreign Scan on users impu (cost=100.00..114.50 rows=150 width=520) (actual time=0.598..5.644 rows=1,732 loops=1)

45. 1.532 7.046 ↓ 11.5 1,732 1

Hash (cost=114.50..114.50 rows=150 width=520) (actual time=7.046..7.046 rows=1,732 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 83kB
46. 5.514 5.514 ↓ 11.5 1,732 1

Foreign Scan on users appu (cost=100.00..114.50 rows=150 width=520) (actual time=0.422..5.514 rows=1,732 loops=1)

47. 1.746 8.282 ↓ 22.5 1,732 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 120kB
48. 6.536 6.536 ↓ 22.5 1,732 1

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

49. 1.708 8.259 ↓ 22.5 1,732 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 120kB
50. 6.551 6.551 ↓ 22.5 1,732 1

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

51. 1.673 8.030 ↓ 22.5 1,732 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 120kB
52. 6.357 6.357 ↓ 22.5 1,732 1

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

53. 1.665 8.164 ↓ 22.5 1,732 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 120kB
54. 6.499 6.499 ↓ 22.5 1,732 1

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

55.          

SubPlan (for Hash Left Join)

56. 205.980 720.930 ↑ 1.0 1 51,495

Aggregate (cost=8.73..8.74 rows=1 width=4) (actual time=0.013..0.014 rows=1 loops=51,495)

57. 514.950 514.950 ↑ 1.0 2 51,495

Index Scan using products_order_id_idx on products (cost=0.29..8.73 rows=2 width=4) (actual time=0.008..0.010 rows=2 loops=51,495)

  • Index Cond: (order_id = o.id)
Planning time : 7.981 ms
Execution time : 5,501.397 ms