explain.depesz.com

PostgreSQL's explain analyze made readable

Result: S7Sv

Settings
# exclusive inclusive rows x rows loops node
1. 0.933 26,806.574 ↓ 23.7 71 1

Sort (cost=7,425.29..7,425.30 rows=3 width=32,707) (actual time=26,806.570..26,806.574 rows=71 loops=1)

  • Sort Key: s."position" DESC, (CASE WHEN ((lpc.givenname IS NOT NULL) AND (lpc.surname IS NOT NULL) AND (lc.cust_name IS NOT NULL)) THEN ((((((lc.cust_name)::text || ' ('::text) || btrim((lpc.givenname)::text)) || ' '::text) || btrim((lpc.surname)::text)) || ')'::text) WHEN ((lpc.givenname IS NULL) AND (lpc.surname IS NOT NULL) AND (lc.cust_name IS NOT NULL)) THEN ((((lc.cust_name)::text || ' ('::text) || btrim((lpc.surname)::text)) || ')'::text) WHEN ((lpc.givenname IS NULL) AND (lpc.surname IS NOT NULL) AND (lc.cust_name IS NULL) AND (lc.cust_address_city IS NOT NULL)) THEN ((((lpc.surname)::text || ' ('::text) || btrim((lc.cust_address_city)::text)) || ')'::text) WHEN ((lpc.givenname IS NOT NULL) AND (lpc.surname IS NOT NULL) AND (lc.cust_name IS NULL) AND (lc.cust_address_city IS NOT NULL)) THEN ((((((lpc.givenname)::text || ' '::text) || btrim((lpc.surname)::text)) || ' ('::text) || btrim((lc.cust_address_city)::text)) || ')'::text) WHEN ((lpc.givenname IS NULL) AND (lpc.surname IS NULL) AND (lc.cust_name IS NOT NULL) AND (lc.cust_address_city IS NOT NULL)) THEN ((((lc.cust_name)::text || ' ('::text) || btrim((lc.cust_address_city)::text)) || ')'::text) WHEN ((lpc.givenname IS NULL) AND (lpc.surname IS NULL) AND (lc.cust_name IS NULL) AND (lc.cust_address_city IS NOT NULL)) THEN (lc.cust_address_city)::text ELSE NULL::text END) DESC
  • Sort Method: quicksort Memory: 204kB
2. 57.601 26,805.641 ↓ 23.7 71 1

Merge Join (cost=4,306.98..7,425.27 rows=3 width=32,707) (actual time=104.847..26,805.641 rows=71 loops=1)

  • Merge Cond: (alu.lead_id = lc.lead_id)
3. 0.427 49.105 ↓ 7.3 2,383 1

Merge Left Join (cost=3,646.10..3,647.77 rows=327 width=508) (actual time=48.526..49.105 rows=2,383 loops=1)

  • Merge Cond: (alu.lead_id = lcu.lead_id)
  • Join Filter: (alu.user_id = lcu.user_id)
4.          

CTE all_lead_users

5. 24.174 30.062 ↑ 1.0 64,900 1

Nested Loop (cost=336.06..2,119.64 rows=65,475 width=248) (actual time=1.837..30.062 rows=64,900 loops=1)

6. 0.717 3.292 ↑ 1.0 2,596 1

Hash Right Join (cost=335.93..479.99 rows=2,619 width=223) (actual time=1.824..3.292 rows=2,596 loops=1)

  • Hash Cond: (lpc_1.lead_id = lc_1.lead_id)
7. 0.765 0.765 ↓ 1.0 2,594 1

Seq Scan on t_lead_person_current lpc_1 (cost=0.00..137.35 rows=2,550 width=23) (actual time=0.008..0.765 rows=2,594 loops=1)

  • Filter: (((maincontact)::text = 'Y'::text) AND ((deleted)::text = 'N'::text))
  • Rows Removed by Filter: 397
8. 0.375 1.810 ↑ 1.0 2,596 1

Hash (cost=303.19..303.19 rows=2,619 width=208) (actual time=1.809..1.810 rows=2,596 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 189kB
9. 1.435 1.435 ↑ 1.0 2,596 1

Seq Scan on t_lead_current lc_1 (cost=0.00..303.19 rows=2,619 width=208) (actual time=0.009..1.435 rows=2,596 loops=1)

10. 2.578 2.596 ↑ 1.0 25 2,596

Materialize (cost=0.14..2.84 rows=25 width=8) (actual time=0.000..0.001 rows=25 loops=2,596)

11. 0.018 0.018 ↑ 1.0 25 1

Index Only Scan using t_user_pkey on t_user u (cost=0.14..2.71 rows=25 width=8) (actual time=0.007..0.018 rows=25 loops=1)

  • Heap Fetches: 25
12.          

CTE lead_chats

13. 0.029 0.387 ↓ 36.0 72 1

GroupAggregate (cost=12.16..12.20 rows=2 width=24) (actual time=0.348..0.387 rows=72 loops=1)

  • Group Key: c.lead_id, ccu.user_id
14. 0.047 0.358 ↓ 77.5 155 1

Sort (cost=12.16..12.17 rows=2 width=24) (actual time=0.344..0.358 rows=155 loops=1)

  • Sort Key: c.lead_id, ccu.user_id
  • Sort Method: quicksort Memory: 37kB
15. 0.034 0.311 ↓ 77.5 155 1

Nested Loop Left Join (cost=10.46..12.15 rows=2 width=24) (actual time=0.194..0.311 rows=155 loops=1)

16. 0.020 0.203 ↓ 74.0 74 1

Hash Join (cost=10.31..11.83 rows=1 width=24) (actual time=0.185..0.203 rows=74 loops=1)

  • Hash Cond: (c.id = ccu.chat_id)
17. 0.007 0.007 ↓ 1.0 38 1

Seq Scan on t_chat c (cost=0.00..1.37 rows=37 width=16) (actual time=0.005..0.007 rows=38 loops=1)

18. 0.009 0.176 ↓ 74.0 74 1

Hash (cost=10.30..10.30 rows=1 width=16) (actual time=0.176..0.176 rows=74 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 12kB
19. 0.012 0.167 ↓ 74.0 74 1

Subquery Scan on ccu (cost=8.86..10.30 rows=1 width=16) (actual time=0.143..0.167 rows=74 loops=1)

  • Filter: (ccu.member = 'Y'::text)
  • Rows Removed by Filter: 2
20. 0.011 0.155 ↓ 1.1 76 1

Unique (cost=8.86..9.40 rows=72 width=96) (actual time=0.141..0.155 rows=76 loops=1)

21. 0.023 0.144 ↓ 1.1 78 1

Sort (cost=8.86..9.04 rows=72 width=96) (actual time=0.140..0.144 rows=78 loops=1)

  • Sort Key: cu.chat_id, cu.user_id
  • Sort Method: quicksort Memory: 31kB
22. 0.052 0.121 ↓ 1.1 78 1

WindowAgg (cost=5.02..6.64 rows=72 width=96) (actual time=0.072..0.121 rows=78 loops=1)

23. 0.022 0.069 ↓ 1.1 78 1

Sort (cost=5.02..5.20 rows=72 width=64) (actual time=0.066..0.069 rows=78 loops=1)

  • Sort Key: cu.chat_id, cu.created_at DESC, cu.id DESC
  • Sort Method: quicksort Memory: 31kB
24. 0.037 0.047 ↓ 1.1 78 1

HashAggregate (cost=2.08..2.80 rows=72 width=64) (actual time=0.034..0.047 rows=78 loops=1)

  • Group Key: cu.id
25. 0.010 0.010 ↓ 1.1 78 1

Seq Scan on t_chat_user cu (cost=0.00..1.72 rows=72 width=34) (actual time=0.006..0.010 rows=78 loops=1)

26. 0.074 0.074 ↑ 1.0 2 74

Index Scan using ix_chat_message_chat_id on t_chat_message cm (cost=0.14..0.30 rows=2 width=16) (actual time=0.001..0.001 rows=2 loops=74)

  • Index Cond: (c.id = chat_id)
27.          

CTE lead_chats_unread

28. 0.036 0.830 ↓ 36.0 72 1

GroupAggregate (cost=27.30..27.36 rows=2 width=88) (actual time=0.796..0.830 rows=72 loops=1)

  • Group Key: lc_2.user_id, lc_2.lead_id, lc_2.newest_entry
29. 0.023 0.794 ↓ 37.0 74 1

Sort (cost=27.30..27.30 rows=2 width=40) (actual time=0.790..0.794 rows=74 loops=1)

  • Sort Key: lc_2.user_id, lc_2.lead_id, lc_2.newest_entry
  • Sort Method: quicksort Memory: 30kB
30. 0.026 0.771 ↓ 37.0 74 1

Hash Right Join (cost=25.78..27.29 rows=2 width=40) (actual time=0.747..0.771 rows=74 loops=1)

  • Hash Cond: ((uum.lead_id = lc_2.lead_id) AND (uum.user_id = lc_2.user_id))
31. 0.023 0.332 ↓ 1.0 76 1

Sort (cost=25.71..25.90 rows=75 width=48) (actual time=0.329..0.332 rows=76 loops=1)

  • Sort Key: uum.lead_id, uum.chat_id, uum.user_id
  • Sort Method: quicksort Memory: 30kB
32.          

CTE allchatmsg

33. 0.020 0.026 ↓ 1.0 37 1

HashAggregate (cost=3.05..3.41 rows=36 width=16) (actual time=0.022..0.026 rows=37 loops=1)

  • Group Key: t_chat_message.chat_id
34. 0.006 0.006 ↓ 1.1 75 1

Seq Scan on t_chat_message (cost=0.00..2.70 rows=70 width=8) (actual time=0.002..0.006 rows=75 loops=1)

35.          

CTE userunreadmsg

36. 0.045 0.234 ↓ 1.0 76 1

HashAggregate (cost=15.90..16.65 rows=75 width=32) (actual time=0.224..0.234 rows=76 loops=1)

  • Group Key: c_1.id, cu_1.user_id
37. 0.030 0.189 ↓ 2.0 153 1

Hash Right Join (cost=11.35..15.15 rows=75 width=48) (actual time=0.157..0.189 rows=153 loops=1)

  • Hash Cond: (cm_1.chat_id = cp.chat_id)
38. 0.007 0.007 ↓ 1.1 75 1

Seq Scan on t_chat_message cm_1 (cost=0.00..2.70 rows=70 width=24) (actual time=0.002..0.007 rows=75 loops=1)

39. 0.011 0.152 ↓ 2.1 76 1

Hash (cost=10.89..10.89 rows=37 width=40) (actual time=0.152..0.152 rows=76 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 14kB
40. 0.025 0.141 ↓ 2.1 76 1

Hash Right Join (cost=8.69..10.89 rows=37 width=40) (actual time=0.116..0.141 rows=76 loops=1)

  • Hash Cond: ((cp.chat_id = cu_1.chat_id) AND (cp.user_id = cu_1.user_id))
41. 0.008 0.008 ↓ 1.0 71 1

Seq Scan on t_chat_progress cp (cost=0.00..1.68 rows=68 width=24) (actual time=0.004..0.008 rows=71 loops=1)

42. 0.011 0.108 ↓ 2.1 76 1

Hash (cost=8.13..8.13 rows=37 width=32) (actual time=0.108..0.108 rows=76 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 13kB
43. 0.020 0.097 ↓ 2.1 76 1

Hash Right Join (cost=6.67..8.13 rows=37 width=32) (actual time=0.066..0.097 rows=76 loops=1)

  • Hash Cond: (cu_1.chat_id = c_1.id)
44. 0.011 0.065 ↓ 1.1 76 1

Unique (cost=4.84..5.38 rows=72 width=96) (actual time=0.051..0.065 rows=76 loops=1)

45. 0.021 0.054 ↓ 1.1 78 1

Sort (cost=4.84..5.02 rows=72 width=96) (actual time=0.051..0.054 rows=78 loops=1)

  • Sort Key: cu_1.chat_id, cu_1.user_id
  • Sort Method: quicksort Memory: 31kB
46. 0.027 0.033 ↓ 1.1 78 1

HashAggregate (cost=1.90..2.62 rows=72 width=96) (actual time=0.023..0.033 rows=78 loops=1)

  • Group Key: cu_1.id
47. 0.006 0.006 ↓ 1.1 78 1

Seq Scan on t_chat_user cu_1 (cost=0.00..1.72 rows=72 width=32) (actual time=0.002..0.006 rows=78 loops=1)

48. 0.005 0.012 ↓ 1.0 38 1

Hash (cost=1.37..1.37 rows=37 width=16) (actual time=0.012..0.012 rows=38 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
49. 0.007 0.007 ↓ 1.0 38 1

Seq Scan on t_chat c_1 (cost=0.00..1.37 rows=37 width=16) (actual time=0.003..0.007 rows=38 loops=1)

50. 0.020 0.309 ↓ 1.0 76 1

Hash Left Join (cost=1.17..3.31 rows=75 width=48) (actual time=0.268..0.309 rows=76 loops=1)

  • Hash Cond: (uum.chat_id = acm.chat_id)
51. 0.250 0.250 ↓ 1.0 76 1

CTE Scan on userunreadmsg uum (cost=0.00..1.50 rows=75 width=32) (actual time=0.225..0.250 rows=76 loops=1)

52. 0.004 0.039 ↓ 1.0 37 1

Hash (cost=0.72..0.72 rows=36 width=16) (actual time=0.039..0.039 rows=37 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
53. 0.035 0.035 ↓ 1.0 37 1

CTE Scan on allchatmsg acm (cost=0.00..0.72 rows=36 width=16) (actual time=0.023..0.035 rows=37 loops=1)

54. 0.010 0.413 ↓ 36.0 72 1

Hash (cost=0.04..0.04 rows=2 width=24) (actual time=0.413..0.413 rows=72 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 12kB
55. 0.403 0.403 ↓ 36.0 72 1

CTE Scan on lead_chats lc_2 (cost=0.00..0.04 rows=2 width=24) (actual time=0.348..0.403 rows=72 loops=1)

56. 0.642 47.823 ↓ 7.3 2,383 1

Sort (cost=1,486.84..1,487.66 rows=327 width=16) (actual time=47.668..47.823 rows=2,383 loops=1)

  • Sort Key: alu.lead_id
  • Sort Method: quicksort Memory: 218kB
57. 47.181 47.181 ↓ 7.9 2,596 1

CTE Scan on all_lead_users alu (cost=0.00..1,473.19 rows=327 width=16) (actual time=1.857..47.181 rows=2,596 loops=1)

  • Filter: (user_id = 3451)
  • Rows Removed by Filter: 62304
58. 0.005 0.855 ↓ 4.0 4 1

Sort (cost=0.06..0.06 rows=1 width=48) (actual time=0.854..0.855 rows=4 loops=1)

  • Sort Key: lcu.lead_id
  • Sort Method: quicksort Memory: 25kB
59. 0.850 0.850 ↓ 4.0 4 1

CTE Scan on lead_chats_unread lcu (cost=0.00..0.04 rows=1 width=48) (actual time=0.838..0.850 rows=4 loops=1)

  • Filter: (user_id = 3451)
  • Rows Removed by Filter: 68
60. 0.422 26,698.935 ↓ 14.2 71 1

Materialize (cost=660.89..3,732.83 rows=5 width=31,266) (actual time=55.229..26,698.935 rows=71 loops=1)

61. 0.429 26,698.513 ↓ 14.2 71 1

Merge Join (cost=660.89..3,732.82 rows=5 width=31,266) (actual time=55.224..26,698.513 rows=71 loops=1)

  • Merge Cond: (lc.lead_id = l_2.id)
62. 0.307 26,692.875 ↓ 71.0 71 1

Nested Loop (cost=584.61..3,392.38 rows=1 width=31,194) (actual time=54.508..26,692.875 rows=71 loops=1)

63. 0.413 26,692.284 ↓ 71.0 71 1

Nested Loop Left Join (cost=584.33..3,392.02 rows=1 width=31,186) (actual time=54.494..26,692.284 rows=71 loops=1)

64. 0.223 26,690.948 ↓ 71.0 71 1

Nested Loop Left Join (cost=583.90..3,389.89 rows=1 width=31,146) (actual time=54.468..26,690.948 rows=71 loops=1)

65. 0.231 26,690.654 ↓ 71.0 71 1

Nested Loop Left Join (cost=583.77..3,389.72 rows=1 width=31,115) (actual time=54.459..26,690.654 rows=71 loops=1)

66. 0.270 26,690.423 ↓ 71.0 71 1

Nested Loop Left Join (cost=583.63..3,389.50 rows=1 width=30,949) (actual time=54.450..26,690.423 rows=71 loops=1)

67. 34.930 26,690.153 ↓ 71.0 71 1

Nested Loop (cost=583.50..3,389.33 rows=1 width=30,923) (actual time=54.440..26,690.153 rows=71 loops=1)

  • Join Filter: (lc.lead_id = l.id)
  • Rows Removed by Join Filter: 201409
68. 5.480 8.711 ↓ 184.0 184 1

GroupAggregate (cost=178.98..476.31 rows=1 width=40) (actual time=1.808..8.711 rows=184 loops=1)

  • Group Key: l.id
  • Filter: (((substr(string_agg((i.name)::text, ', '::text ORDER BY (i.name)::text), 1, 497) || CASE WHEN (length(string_agg((i.name)::text, ', '::text ORDER BY (i.name)::text)) > 497) THEN '...'::text ELSE ''::text END) IS NOT NULL) AND (lower((substr(string_agg((i.name)::text, ', '::text ORDER BY (i.name)::text), 1, 497) || CASE WHEN (length(string_agg((i.name)::text, ', '::text ORDER BY (i.name)::text)) > 497) THEN '...'::text ELSE ''::text END)) ~~ '%medizin%'::text))
  • Rows Removed by Filter: 2412
69. 1.018 3.231 ↑ 1.0 2,629 1

Merge Left Join (cost=178.98..296.14 rows=2,669 width=23) (actual time=0.990..3.231 rows=2,629 loops=1)

  • Merge Cond: (l.id = li.lead_id)
70. 0.980 0.980 ↑ 1.0 2,596 1

Index Only Scan using t_lead_pkey on t_lead l (cost=0.28..77.71 rows=2,669 width=8) (actual time=0.008..0.980 rows=2,596 loops=1)

  • Heap Fetches: 2596
71. 0.635 1.233 ↑ 1.0 2,204 1

Sort (cost=178.70..184.21 rows=2,204 width=23) (actual time=0.980..1.233 rows=2,204 loops=1)

  • Sort Key: li.lead_id
  • Sort Method: quicksort Memory: 275kB
72. 0.406 0.598 ↑ 1.0 2,204 1

Hash Left Join (cost=1.72..56.31 rows=2,204 width=23) (actual time=0.023..0.598 rows=2,204 loops=1)

  • Hash Cond: (li.industry_id = i.id)
73. 0.178 0.178 ↑ 1.0 2,204 1

Seq Scan on t_lead_industry li (cost=0.00..48.04 rows=2,204 width=16) (actual time=0.005..0.178 rows=2,204 loops=1)

74. 0.005 0.014 ↑ 1.0 32 1

Hash (cost=1.32..1.32 rows=32 width=23) (actual time=0.014..0.014 rows=32 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
75. 0.009 0.009 ↑ 1.0 32 1

Seq Scan on t_industry i (cost=0.00..1.32 rows=32 width=23) (actual time=0.005..0.009 rows=32 loops=1)

76. 25,999.560 26,646.512 ↓ 2.0 1,095 184

Hash Join (cost=404.52..2,900.39 rows=561 width=31,487) (actual time=0.191..144.818 rows=1,095 loops=184)

  • Hash Cond: (lc.dealreg_dealreg_id = d.id)
77. 483.133 646.944 ↓ 2.0 1,095 184

Hash Right Join (cost=403.41..555.78 rows=561 width=30,596) (actual time=0.052..3.516 rows=1,095 loops=184)

  • Hash Cond: (lpc.lead_id = lc.lead_id)
78. 155.296 155.296 ↓ 1.0 2,594 184

Seq Scan on t_lead_person_current lpc (cost=0.00..137.35 rows=2,550 width=409) (actual time=0.003..0.844 rows=2,594 loops=184)

  • Filter: (((maincontact)::text = 'Y'::text) AND ((deleted)::text = 'N'::text))
  • Rows Removed by Filter: 397
79. 1.663 8.515 ↓ 2.0 1,095 1

Hash (cost=396.39..396.39 rows=561 width=30,195) (actual time=8.515..8.515 rows=1,095 loops=1)

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 988kB
80. 2.053 6.852 ↓ 2.0 1,095 1

Hash Join (cost=329.09..396.39 rows=561 width=30,195) (actual time=4.603..6.852 rows=1,095 loops=1)

  • Hash Cond: (l_1.id = lc.lead_id)
81. 0.219 0.219 ↑ 1.0 2,596 1

Seq Scan on t_lead l_1 (cost=0.00..51.69 rows=2,669 width=664) (actual time=0.004..0.219 rows=2,596 loops=1)

82. 1.708 4.580 ↓ 2.0 1,095 1

Hash (cost=322.07..322.07 rows=561 width=29,539) (actual time=4.580..4.580 rows=1,095 loops=1)

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 954kB
83. 1.584 2.872 ↓ 2.0 1,095 1

Hash Join (cost=1.50..322.07 rows=561 width=29,539) (actual time=0.037..2.872 rows=1,095 loops=1)

  • Hash Cond: (lc.status_id = s.id)
84. 1.271 1.271 ↑ 1.1 1,258 1

Seq Scan on t_lead_current lc (cost=0.00..316.28 rows=1,372 width=29,504) (actual time=0.006..1.271 rows=1,258 loops=1)

  • Filter: ((status_wonlost_id IS NULL) AND (((status_user_id = 3451) AND (status_user_id IS NOT NULL)) OR ((status_reseller_id = 1704) AND (status_reseller_id IS NOT NULL))))
  • Rows Removed by Filter: 1338
85. 0.005 0.017 ↓ 1.6 14 1

Hash (cost=1.39..1.39 rows=9 width=43) (actual time=0.017..0.017 rows=14 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
86. 0.012 0.012 ↓ 1.6 14 1

Seq Scan on t_status s (cost=0.00..1.39 rows=9 width=43) (actual time=0.007..0.012 rows=14 loops=1)

  • Filter: ((picked IS NOT NULL) AND ((picked)::text = 'Y'::text) AND (((picked)::text = 'Y'::text) OR ((closed)::text = 'Y'::text)))
  • Rows Removed by Filter: 8
87. 0.002 0.008 ↑ 1.0 5 1

Hash (cost=1.05..1.05 rows=5 width=25) (actual time=0.008..0.008 rows=5 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
88. 0.006 0.006 ↑ 1.0 5 1

Seq Scan on t_dealreg d (cost=0.00..1.05 rows=5 width=25) (actual time=0.005..0.006 rows=5 loops=1)

89. 0.000 0.000 ↓ 0.0 0 71

Index Scan using t_company_pkey on t_company addressowner_comp (cost=0.12..0.15 rows=1 width=26) (actual time=0.000..0.000 rows=0 loops=71)

  • Index Cond: (lc.md_company_id = id)
90. 0.000 0.000 ↓ 0.0 0 71

Index Scan using t_distributor_pkey on t_distributor addressowner_dist (cost=0.14..0.18 rows=1 width=166) (actual time=0.000..0.000 rows=0 loops=71)

  • Index Cond: (lc.md_distributor_id = id)
91. 0.071 0.071 ↓ 0.0 0 71

Index Scan using t_reseller_pkey on t_reseller addressowner_res (cost=0.13..0.16 rows=1 width=31) (actual time=0.001..0.001 rows=0 loops=71)

  • Index Cond: (lc.md_reseller_id = id)
92. 0.923 0.923 ↑ 1.0 1 71

Index Scan using ux_zipcode_data_agg_id on mv_zipcode_data_agg (cost=0.43..2.13 rows=1 width=62) (actual time=0.013..0.013 rows=1 loops=71)

  • Index Cond: (((((lower((upper(gettranslation_default('T_COUNTRY'::text, lc.cust_address_country_id, 'ISO_3166_1_ALPHA_2'::text, to_char(CURRENT_TIMESTAMP, 'HH24:MI:SS DD Mon YYYY'::text))))) || '--'::text) || (lc.cust_address_zipcode)::text) || '--'::text) || (lc.cust_address_city)::text) = id)
93. 0.284 0.284 ↑ 1.0 1 71

Index Only Scan using t_lead_pkey on t_lead (cost=0.28..0.36 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=71)

  • Index Cond: (id = lc.lead_id)
  • Heap Fetches: 71
94. 4.227 5.209 ↑ 1.1 2,382 1

GroupAggregate (cost=76.27..307.02 rows=2,669 width=72) (actual time=0.023..5.209 rows=2,382 loops=1)

  • Group Key: l_2.id
95. 0.320 0.982 ↑ 1.1 2,383 1

Merge Left Join (cost=76.27..173.57 rows=2,669 width=234) (actual time=0.012..0.982 rows=2,383 loops=1)

  • Merge Cond: (l_2.id = lp.lead_id)
96. 0.657 0.657 ↑ 1.1 2,383 1

Index Only Scan using t_lead_pkey on t_lead l_2 (cost=0.28..77.71 rows=2,669 width=8) (actual time=0.006..0.657 rows=2,383 loops=1)

  • Heap Fetches: 2383
97. 0.003 0.005 ↓ 0.0 0 1

Sort (cost=75.99..78.19 rows=880 width=234) (actual time=0.005..0.005 rows=0 loops=1)

  • Sort Key: lp.lead_id
  • Sort Method: quicksort Memory: 25kB
98. 0.000 0.002 ↓ 0.0 0 1

Hash Left Join (cost=11.80..32.95 rows=880 width=234) (actual time=0.002..0.002 rows=0 loops=1)

  • Hash Cond: (lp.product_id = p.id)
99. 0.002 0.002 ↓ 0.0 0 1

Seq Scan on t_lead_productinterest lp (cost=0.00..18.80 rows=880 width=16) (actual time=0.002..0.002 rows=0 loops=1)

100. 0.000 0.000 ↓ 0.0 0

Hash (cost=10.80..10.80 rows=80 width=226) (never executed)

101. 0.000 0.000 ↓ 0.0 0

Seq Scan on t_product p (cost=0.00..10.80 rows=80 width=226) (never executed)

Planning time : 7.572 ms
Execution time : 26,808.142 ms