explain.depesz.com

PostgreSQL's explain analyze made readable

Result: gbOa

Settings
# exclusive inclusive rows x rows loops node
1. 1,591,765.012 1,591,765.012 ↑ 82.1 2,034 1

CTE Scan on queue_pop (cost=839,629,497,427,001,737,216.00..839,629,497,427,001,737,216.00 rows=166,899 width=68) (actual time=1,591,763.199..1,591,765.012 rows=2,034 loops=1)

2.          

CTE queue_pop

3. 1.159 1,591,764.443 ↑ 82.1 2,034 1

GroupAggregate (cost=765,587,233,678,097,907,712.00..839,629,497,427,001,737,216.00 rows=166,899 width=68) (actual time=1,591,763.196..1,591,764.443 rows=2,034 loops=1)

  • Group Key: clients.prod_user_id
4. 0.618 1,591,763.284 ↑ 466,724,009,952,590,336.0 2,047 1

Sort (cost=765,587,233,678,097,907,712.00..767,975,693,799,030,259,712.00 rows=955,384,048,372,952,465,408 width=92) (actual time=1,591,763.182..1,591,763.284 rows=2,047 loops=1)

  • Sort Key: clients.prod_user_id
  • Sort Method: quicksort Memory: 204kB
5. 17.451 1,591,762.666 ↑ 466,724,009,952,590,336.0 2,047 1

Merge Left Join (cost=5,196,414.85..40,804,745,687,936,385,024.00 rows=955,384,048,372,952,465,408 width=92) (actual time=1,591,230.252..1,591,762.666 rows=2,047 loops=1)

  • Merge Cond: ((clients.prod_user_id)::numeric = ((draws.prod_user_id)::numeric))
  • Filter: (COALESCE(((CASE WHEN (business_request_notes.request_type ~~ '%INCREASE'::text) THEN 1 ELSE NULL::integer END))::bigint, notes.all_notes_to_risk, notes.user_notes, ((CASE WHEN (business_request_notes.request_type = 'PRIMARY_BANK_CHANGE'::text) THEN 1 ELSE NULL::integer END))::bigint, ((CASE WHEN (business_request_notes.request_type ~~ '%FLEX%'::text) THEN 1 ELSE NULL::integer END))::bigint, ((CASE WHEN ((business_request_notes.request_type = 'CLIENT_PRE_APPROVAL'::text) AND (business_request_notes.requested_credit_line > '0'::numeric)) THEN 1 ELSE NULL::integer END))::bigint, ((CASE WHEN (business_request_notes.request_type = 'TERM_LOAN_RENEWAL'::text) THEN 1 ELSE NULL::integer END))::bigint, ((CASE WHEN (business_request_notes.request_type = 'NEW_BANKING_APPLICATION'::text) THEN 1 ELSE NULL::integer END))::bigint, ((CASE WHEN (business_request_notes.request_type ~~ '%SBA%'::text) THEN 1 ELSE NULL::integer END))::bigint, ((CASE WHEN (a.changes_requested > 0) THEN 1 ELSE NULL::integer END))::bigint, advances.deal_ct, draws.draw_ct, files.has_vc, tasks.has_tasks) IS NOT NULL)
  • Rows Removed by Filter: 52,080
6. 148.989 1,527,250.301 ↑ 2,528,792,954,125,690.5 54,127 1

Merge Left Join (cost=4,897,935.09..1,370,776,936,660,463,872.00 rows=136,875,976,227,961,241,600 width=84) (actual time=1,526,735.104..1,527,250.301 rows=54,127 loops=1)

  • Merge Cond: ((clients.prod_user_id)::numeric = files.prod_user_id)
7. 64.285 1,481,409.367 ↑ 1,489,904,732,632.2 54,127 1

Merge Left Join (cost=3,042,217.80..1,613,954,011,677,297.25 rows=80,644,073,463,184,576 width=68) (actual time=1,481,205.937..1,481,409.367 rows=54,127 loops=1)

  • Merge Cond: ((clients.prod_user_id)::numeric = ((tasks.prod_user_id)::numeric))
8. 57.236 1,442,872.314 ↑ 720,152,127.4 54,127 1

Merge Left Join (cost=2,851,735.17..780,194,666,759.23 rows=38,979,674,201,282 width=60) (actual time=1,442,751.800..1,442,872.314 rows=54,127 loops=1)

  • Merge Cond: ((clients.prod_user_id)::numeric = ((offers.prod_user_id)::numeric))
9. 22.019 1,397,171.293 ↑ 401,668.9 54,127 1

Merge Left Join (cost=2,718,834.33..437,991,334.30 rows=21,741,131,241 width=60) (actual time=1,397,122.985..1,397,171.293 rows=54,127 loops=1)

  • Merge Cond: ((clients.prod_user_id)::numeric = ((business_request_notes.prod_user_id)::numeric))
10. 15.379 1,346,985.945 ↑ 296.7 54,114 1

Merge Left Join (cost=2,342,926.82..2,672,406.43 rows=16,054,475 width=32) (actual time=1,346,962.523..1,346,985.945 rows=54,114 loops=1)

  • Merge Cond: (((clients.prod_user_id)::numeric) = ((advances.prod_user_id)::numeric))
11. 66.309 1,246,938.690 ↑ 15.5 54,114 1

Sort (cost=2,252,477.88..2,254,575.40 rows=839,011 width=24) (actual time=1,246,930.707..1,246,938.690 rows=54,114 loops=1)

  • Sort Key: ((clients.prod_user_id)::numeric)
  • Sort Method: quicksort Memory: 4,122kB
12. 47.321 1,246,872.381 ↑ 15.5 54,114 1

Hash Left Join (cost=1,490,339.18..2,152,716.70 rows=839,011 width=24) (actual time=840,513.573..1,246,872.381 rows=54,114 loops=1)

  • Hash Cond: (clients.prod_user_id = notes.prod_user_id)
13. 59.125 1,215,619.373 ↑ 8.2 54,114 1

Hash Left Join (cost=842,471.31..1,503,678.93 rows=445,667 width=8) (actual time=809,306.914..1,215,619.373 rows=54,114 loops=1)

  • Hash Cond: ((clients.prod_user_id)::numeric = a.prod_user_id)
14. 406,253.414 406,253.414 ↑ 8.2 54,114 1

Index Scan using clients_last_record_idx on clients (cost=0.56..659,955.31 rows=445,667 width=4) (actual time=0.071..406,253.414 rows=54,114 loops=1)

  • Index Cond: (last_record = '1'::numeric)
  • Filter: (is_real AND (NOT is_test) AND ((user_account_type)::text !~~ '%ppp%'::text) AND (user_status <> ALL ('{CREATED,UNQUALIFIED,CANCELED,REJECTED,INACTIVE}'::text[])))
  • Rows Removed by Filter: 1,403,472
15. 0.009 809,306.834 ↑ 3.1 19 1

Hash (cost=842,470.02..842,470.02 rows=58 width=12) (actual time=809,306.834..809,306.834 rows=19 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
16. 0.006 809,306.825 ↑ 3.1 19 1

Subquery Scan on a (cost=842,468.28..842,470.02 rows=58 width=12) (actual time=809,306.810..809,306.825 rows=19 loops=1)

17. 0.017 809,306.819 ↑ 3.1 19 1

GroupAggregate (cost=842,468.28..842,469.29 rows=58 width=16) (actual time=809,306.807..809,306.819 rows=19 loops=1)

  • Group Key: events_change_request_04102020_11102020.prod_user_id
18. 0.075 809,306.802 ↑ 2.5 23 1

Sort (cost=842,468.28..842,468.42 rows=58 width=8) (actual time=809,306.800..809,306.802 rows=23 loops=1)

  • Sort Key: events_change_request_04102020_11102020.prod_user_id
  • Sort Method: quicksort Memory: 26kB
19. 0.467 809,306.727 ↑ 2.5 23 1

Hash Join (cost=667,856.60..842,466.58 rows=58 width=8) (actual time=774,801.459..809,306.727 rows=23 loops=1)

  • Hash Cond: (events_change_request_04102020_11102020.prod_user_id = (clients_1.prod_user_id)::numeric)
20. 0.042 41,722.611 ↑ 2.0 57 1

Append (cost=0.57..174,609.52 rows=116 width=8) (actual time=1,790.502..41,722.611 rows=57 loops=1)

  • Subplans Removed: 102
21. 39,837.131 40,045.626 ↓ 28.0 56 1

Bitmap Heap Scan on events_change_request_04102020_11102020 (cost=1,994.94..166,103.66 rows=2 width=5) (actual time=1,790.500..40,045.626 rows=56 loops=1)

  • Recheck Cond: (field_name = ANY ('{email,personal_user_first_name,personal_user_last_name,business_entity_type,personal_authorised_person_full_name,bluevine_due_date,number_of_installments,business_address,business_address_state,business_address_zip,business_name}'::text[]))
  • Filter: ((last_record = 1) AND ((status)::text = 'P'::text) AND (updated > (now() - '7 days'::interval)))
  • Rows Removed by Filter: 71,585
  • Heap Blocks: exact=34,253
22. 208.495 208.495 ↓ 1.1 71,693 1

Bitmap Index Scan on events_change_request_field_name_idx_04102020 (cost=0.00..1,994.93 rows=66,959 width=0) (actual time=208.495..208.495 rows=71,693 loops=1)

  • Index Cond: (field_name = ANY ('{email,personal_user_first_name,personal_user_last_name,business_entity_type,personal_authorised_person_full_name,bluevine_due_date,number_of_installments,business_address,business_address_state,business_address_zip,business_name}'::text[]))
23. 1,670.425 1,676.902 ↑ 1.0 1 1

Bitmap Heap Scan on events_change_request_11102020_18102020 (cost=112.86..7,931.04 rows=1 width=5) (actual time=138.221..1,676.902 rows=1 loops=1)

  • Recheck Cond: (field_name = ANY ('{email,personal_user_first_name,personal_user_last_name,business_entity_type,personal_authorised_person_full_name,bluevine_due_date,number_of_installments,business_address,business_address_state,business_address_zip,business_name}'::text[]))
  • Filter: ((last_record = 1) AND ((status)::text = 'P'::text) AND (updated > (now() - '7 days'::interval)))
  • Rows Removed by Filter: 2,962
  • Heap Blocks: exact=1,430
24. 6.477 6.477 ↓ 1.1 3,011 1

Bitmap Index Scan on events_change_request_field_name_idx_11102020 (cost=0.00..112.86 rows=2,695 width=0) (actual time=6.477..6.477 rows=3,011 loops=1)

  • Index Cond: (field_name = ANY ('{email,personal_user_first_name,personal_user_last_name,business_entity_type,personal_authorised_person_full_name,bluevine_due_date,number_of_installments,business_address,business_address_state,business_address_zip,business_name}'::text[]))
25. 0.007 0.007 ↓ 0.0 0 1

Index Scan using events_change_request_row_id_last_record_idx_18102020 on events_change_request_18102020_25102020 (cost=0.14..9.75 rows=1 width=32) (actual time=0.007..0.007 rows=0 loops=1)

  • Index Cond: (last_record = 1)
  • Filter: (((status)::text = 'P'::text) AND (updated > (now() - '7 days'::interval)) AND (field_name = ANY ('{email,personal_user_first_name,personal_user_last_name,business_entity_type,personal_authorised_person_full_name,bluevine_due_date,number_of_installments,business_address,business_address_state,business_address_zip,business_name}'::text[])))
26. 0.003 0.003 ↓ 0.0 0 1

Index Scan using events_change_request_row_id_last_record_idx_25102020 on events_change_request_25102020_01112020 (cost=0.14..9.75 rows=1 width=32) (actual time=0.003..0.003 rows=0 loops=1)

  • Index Cond: (last_record = 1)
  • Filter: (((status)::text = 'P'::text) AND (updated > (now() - '7 days'::interval)) AND (field_name = ANY ('{email,personal_user_first_name,personal_user_last_name,business_entity_type,personal_authorised_person_full_name,bluevine_due_date,number_of_installments,business_address,business_address_state,business_address_zip,business_name}'::text[])))
27. 0.003 0.003 ↓ 0.0 0 1

Index Scan using events_change_request_row_id_last_record_idx_01112020 on events_change_request_01112020_08112020 (cost=0.14..9.75 rows=1 width=32) (actual time=0.003..0.003 rows=0 loops=1)

  • Index Cond: (last_record = 1)
  • Filter: (((status)::text = 'P'::text) AND (updated > (now() - '7 days'::interval)) AND (field_name = ANY ('{email,personal_user_first_name,personal_user_last_name,business_entity_type,personal_authorised_person_full_name,bluevine_due_date,number_of_installments,business_address,business_address_state,business_address_zip,business_name}'::text[])))
28. 0.003 0.003 ↓ 0.0 0 1

Index Scan using events_change_request_row_id_last_record_idx_08112020 on events_change_request_08112020_15112020 (cost=0.14..9.75 rows=1 width=32) (actual time=0.003..0.003 rows=0 loops=1)

  • Index Cond: (last_record = 1)
  • Filter: (((status)::text = 'P'::text) AND (updated > (now() - '7 days'::interval)) AND (field_name = ANY ('{email,personal_user_first_name,personal_user_last_name,business_entity_type,personal_authorised_person_full_name,bluevine_due_date,number_of_installments,business_address,business_address_state,business_address_zip,business_name}'::text[])))
29. 0.003 0.003 ↓ 0.0 0 1

Index Scan using events_change_request_row_id_last_record_idx_15112020 on events_change_request_15112020_22112020 (cost=0.14..9.75 rows=1 width=32) (actual time=0.003..0.003 rows=0 loops=1)

  • Index Cond: (last_record = 1)
  • Filter: (((status)::text = 'P'::text) AND (updated > (now() - '7 days'::interval)) AND (field_name = ANY ('{email,personal_user_first_name,personal_user_last_name,business_entity_type,personal_authorised_person_full_name,bluevine_due_date,number_of_installments,business_address,business_address_state,business_address_zip,business_name}'::text[])))
30. 0.004 0.004 ↓ 0.0 0 1

Index Scan using events_change_request_row_id_last_record_idx_22112020 on events_change_request_22112020_29112020 (cost=0.14..9.75 rows=1 width=32) (actual time=0.004..0.004 rows=0 loops=1)

  • Index Cond: (last_record = 1)
  • Filter: (((status)::text = 'P'::text) AND (updated > (now() - '7 days'::interval)) AND (field_name = ANY ('{email,personal_user_first_name,personal_user_last_name,business_entity_type,personal_authorised_person_full_name,bluevine_due_date,number_of_installments,business_address,business_address_state,business_address_zip,business_name}'::text[])))
31. 0.003 0.003 ↓ 0.0 0 1

Index Scan using events_change_request_row_id_last_record_idx_29112020 on events_change_request_29112020_06122020 (cost=0.14..9.75 rows=1 width=32) (actual time=0.003..0.003 rows=0 loops=1)

  • Index Cond: (last_record = 1)
  • Filter: (((status)::text = 'P'::text) AND (updated > (now() - '7 days'::interval)) AND (field_name = ANY ('{email,personal_user_first_name,personal_user_last_name,business_entity_type,personal_authorised_person_full_name,bluevine_due_date,number_of_installments,business_address,business_address_state,business_address_zip,business_name}'::text[])))
32. 0.004 0.004 ↓ 0.0 0 1

Index Scan using events_change_request_row_id_last_record_idx_06122020 on events_change_request_06122020_13122020 (cost=0.14..9.75 rows=1 width=32) (actual time=0.004..0.004 rows=0 loops=1)

  • Index Cond: (last_record = 1)
  • Filter: (((status)::text = 'P'::text) AND (updated > (now() - '7 days'::interval)) AND (field_name = ANY ('{email,personal_user_first_name,personal_user_last_name,business_entity_type,personal_authorised_person_full_name,bluevine_due_date,number_of_installments,business_address,business_address_state,business_address_zip,business_name}'::text[])))
33. 0.004 0.004 ↓ 0.0 0 1

Index Scan using events_change_request_row_id_last_record_idx_13122020 on events_change_request_13122020_20122020 (cost=0.14..9.75 rows=1 width=32) (actual time=0.004..0.004 rows=0 loops=1)

  • Index Cond: (last_record = 1)
  • Filter: (((status)::text = 'P'::text) AND (updated > (now() - '7 days'::interval)) AND (field_name = ANY ('{email,personal_user_first_name,personal_user_last_name,business_entity_type,personal_authorised_person_full_name,bluevine_due_date,number_of_installments,business_address,business_address_state,business_address_zip,business_name}'::text[])))
34. 0.003 0.003 ↓ 0.0 0 1

Index Scan using events_change_request_row_id_last_record_idx_20122020 on events_change_request_20122020_27122020 (cost=0.14..9.75 rows=1 width=32) (actual time=0.003..0.003 rows=0 loops=1)

  • Index Cond: (last_record = 1)
  • Filter: (((status)::text = 'P'::text) AND (updated > (now() - '7 days'::interval)) AND (field_name = ANY ('{email,personal_user_first_name,personal_user_last_name,business_entity_type,personal_authorised_person_full_name,bluevine_due_date,number_of_installments,business_address,business_address_state,business_address_zip,business_name}'::text[])))
35. 0.004 0.004 ↓ 0.0 0 1

Index Scan using events_change_request_row_id_last_record_idx_27122020 on events_change_request_27122020_03012021 (cost=0.14..9.75 rows=1 width=32) (actual time=0.004..0.004 rows=0 loops=1)

  • Index Cond: (last_record = 1)
  • Filter: (((status)::text = 'P'::text) AND (updated > (now() - '7 days'::interval)) AND (field_name = ANY ('{email,personal_user_first_name,personal_user_last_name,business_entity_type,personal_authorised_person_full_name,bluevine_due_date,number_of_installments,business_address,business_address_state,business_address_zip,business_name}'::text[])))
36. 71.077 767,583.649 ↓ 1.1 189,676 1

Hash (cost=665,713.08..665,713.08 rows=171,436 width=4) (actual time=767,583.649..767,583.649 rows=189,676 loops=1)

  • Buckets: 262,144 Batches: 1 Memory Usage: 8,717kB
37. 329.206 767,512.572 ↓ 1.1 189,676 1

HashAggregate (cost=663,998.72..665,713.08 rows=171,436 width=4) (actual time=767,452.880..767,512.572 rows=189,676 loops=1)

  • Group Key: (clients_1.prod_user_id)::numeric
38. 767,183.366 767,183.366 ↑ 2.7 189,676 1

Index Scan using clients_last_record_idx on clients clients_1 (cost=0.56..662,730.86 rows=507,142 width=4) (actual time=0.048..767,183.366 rows=189,676 loops=1)

  • Index Cond: (last_record = '1'::numeric)
  • Filter: (is_real AND (flags !~~ '%wait%'::text) AND (user_status = ANY ('{APPLIED,APPROVED,SUSPENDED}'::text[])))
  • Rows Removed by Filter: 1,267,910
39. 5.732 31,205.687 ↑ 17.9 19,187 1

Hash (cost=643,569.60..643,569.60 rows=343,862 width=20) (actual time=31,205.687..31,205.687 rows=19,187 loops=1)

  • Buckets: 524,288 Batches: 1 Memory Usage: 4,969kB
40. 2.941 31,199.955 ↑ 17.9 19,187 1

Subquery Scan on notes (cost=636,692.36..643,569.60 rows=343,862 width=20) (actual time=31,188.623..31,199.955 rows=19,187 loops=1)

41. 33.811 31,197.014 ↑ 17.9 19,187 1

HashAggregate (cost=636,692.36..640,130.98 rows=343,862 width=20) (actual time=31,188.621..31,197.014 rows=19,187 loops=1)

  • Group Key: a_1.prod_user_id
42. 31,163.203 31,163.203 ↑ 25.5 27,393 1

Seq Scan on unified_notes a_1 (cost=0.00..629,694.48 rows=699,788 width=8) (actual time=58.827..31,163.203 rows=27,393 loops=1)

  • Filter: ((NOT deleted) AND (prod_user_id IS NOT NULL) AND ((target_group)::text = 'risk'::text) AND (last_record = 1) AND (((status)::text = 'open'::text) OR ((status)::text = 'in process'::text)))
  • Rows Removed by Filter: 5,858,371
43. 3.150 100,031.876 ↑ 8.1 472 1

Sort (cost=90,448.94..90,458.51 rows=3,827 width=12) (actual time=100,031.807..100,031.876 rows=472 loops=1)

  • Sort Key: ((advances.prod_user_id)::numeric)
  • Sort Method: quicksort Memory: 61kB
44. 0.071 100,028.726 ↑ 8.1 472 1

Subquery Scan on advances (cost=90,055.26..90,221.20 rows=3,827 width=12) (actual time=100,028.433..100,028.726 rows=472 loops=1)

45. 0.162 100,028.655 ↑ 8.1 472 1

GroupAggregate (cost=90,055.26..90,182.93 rows=3,827 width=12) (actual time=100,028.430..100,028.655 rows=472 loops=1)

  • Group Key: advances_1.prod_user_id
46. 1.156 100,028.493 ↑ 11.4 1,043 1

Sort (cost=90,055.26..90,085.06 rows=11,920 width=4) (actual time=100,028.422..100,028.493 rows=1,043 loops=1)

  • Sort Key: advances_1.prod_user_id
  • Sort Method: quicksort Memory: 97kB
47. 100,027.337 100,027.337 ↑ 11.4 1,043 1

Index Scan using advances_last_record_idx on advances advances_1 (cost=0.42..89,248.21 rows=11,920 width=4) (actual time=478.844..100,027.337 rows=1,043 loops=1)

  • Filter: (((waiting_for)::text = 'R'::text) AND ((now() - '00:50:00'::interval) > deal_update_date))
  • Rows Removed by Filter: 361,100
48. 43.593 50,163.329 ↑ 10.2 26,435 1

Sort (cost=375,907.51..376,584.62 rows=270,842 width=32) (actual time=50,160.454..50,163.329 rows=26,435 loops=1)

  • Sort Key: ((business_request_notes.prod_user_id)::numeric)
  • Sort Method: quicksort Memory: 2,834kB
49. 36,513.360 50,119.736 ↑ 10.2 26,435 1

Bitmap Heap Scan on business_request_notes (cost=104,904.05..351,467.96 rows=270,842 width=32) (actual time=13,614.918..50,119.736 rows=26,435 loops=1)

  • Recheck Cond: ((status = 'PENDING'::text) AND (last_record = 1))
  • Filter: (((waiting_for)::text = 'R'::text) AND (((request_type ~~ '%INCREASE'::text) AND (last_updated < (now() - '00:30:00'::interval))) OR (request_type !~~ '%INCREASE'::text)))
  • Rows Removed by Filter: 18,092
  • Heap Blocks: exact=33,930
50. 13,606.376 13,606.376 ↑ 11.2 74,381 1

Bitmap Index Scan on idx_business_request_notes_last_record_request_type_status (cost=0.00..104,836.34 rows=836,569 width=0) (actual time=13,606.376..13,606.376 rows=74,381 loops=1)

  • Index Cond: (status = 'PENDING'::text)
51. 110.255 45,643.785 ↑ 1.4 261,913 1

Sort (cost=132,900.84..133,797.29 rows=358,580 width=4) (actual time=45,628.805..45,643.785 rows=261,913 loops=1)

  • Sort Key: ((offers.prod_user_id)::numeric)
  • Sort Method: quicksort Memory: 18,422kB
52. 78.547 45,533.530 ↑ 1.4 261,913 1

Subquery Scan on offers (cost=0.42..99,818.37 rows=358,580 width=4) (actual time=18.248..45,533.530 rows=261,913 loops=1)

53. 243.292 45,454.983 ↑ 1.4 261,913 1

GroupAggregate (cost=0.42..96,232.57 rows=358,580 width=20) (actual time=18.246..45,454.983 rows=261,913 loops=1)

  • Group Key: creditline_offers.user_id
54. 45,211.691 45,211.691 ↑ 1.8 312,174 1

Index Scan using creditline_offers_user_id_idx on creditline_offers (cost=0.42..91,248.30 rows=559,388 width=4) (actual time=16.240..45,211.691 rows=312,174 loops=1)

  • Filter: (status = ANY ('{EXPIRED_SALES,EXPIRED_CLIENT,PENDING_SALES,PENDING_CLIENT,ACCEPTED}'::text[]))
  • Rows Removed by Filter: 507,519
55. 162.968 38,472.768 ↑ 1.1 385,193 1

Sort (cost=190,482.63..191,517.07 rows=413,775 width=12) (actual time=38,454.129..38,472.768 rows=385,193 loops=1)

  • Sort Key: ((tasks.prod_user_id)::numeric)
  • Sort Method: quicksort Memory: 39,167kB
56. 95.551 38,309.800 ↑ 1.1 385,188 1

Subquery Scan on tasks (cost=0.43..151,880.56 rows=413,775 width=12) (actual time=635.365..38,309.800 rows=385,188 loops=1)

57. 284.254 38,214.249 ↑ 1.1 385,188 1

GroupAggregate (cost=0.43..147,742.81 rows=413,775 width=12) (actual time=635.362..38,214.249 rows=385,188 loops=1)

  • Group Key: user_tasks.user_id
58. 37,929.995 37,929.995 ↑ 1.0 717,494 1

Index Scan using user_tasks_user_id on user_tasks (cost=0.43..139,965.55 rows=727,902 width=4) (actual time=461.537..37,929.995 rows=717,494 loops=1)

  • Filter: ((status)::text = 'PENDING_REVIEW'::text)
  • Rows Removed by Filter: 1,065,878
59. 748.548 45,691.945 ↓ 2.8 945,576 1

Sort (cost=1,855,717.29..1,856,565.93 rows=339,457 width=22) (actual time=45,529.160..45,691.945 rows=945,576 loops=1)

  • Sort Key: files.prod_user_id
  • Sort Method: external merge Disk: 16,776kB
60. 94.363 44,943.397 ↓ 2.8 945,576 1

Subquery Scan on files (cost=1,817,744.15..1,824,533.29 rows=339,457 width=22) (actual time=44,589.665..44,943.397 rows=945,576 loops=1)

61. 3,558.158 44,849.034 ↓ 2.8 945,576 1

HashAggregate (cost=1,817,744.15..1,821,138.72 rows=339,457 width=22) (actual time=44,589.663..44,849.034 rows=945,576 loops=1)

  • Group Key: files_1.prod_user_id
62. 41,290.876 41,290.876 ↓ 1.0 4,793,995 1

Seq Scan on files files_1 (cost=0.00..1,638,111.24 rows=4,790,211 width=37) (actual time=0.055..41,290.876 rows=4,793,995 loops=1)

  • Filter: (last_record = 1)
  • Rows Removed by Filter: 5,692,087
63. 0.083 64,494.914 ↑ 3.4 417 1

Materialize (cost=298,479.76..298,486.77 rows=1,403 width=12) (actual time=64,494.776..64,494.914 rows=417 loops=1)

64. 0.193 64,494.831 ↑ 3.4 417 1

Sort (cost=298,479.76..298,483.26 rows=1,403 width=12) (actual time=64,494.770..64,494.831 rows=417 loops=1)

  • Sort Key: ((draws.prod_user_id)::numeric)
  • Sort Method: quicksort Memory: 57kB
65. 0.114 64,494.638 ↑ 3.4 417 1

Subquery Scan on draws (cost=298,367.43..298,406.42 rows=1,403 width=12) (actual time=64,494.173..64,494.638 rows=417 loops=1)

66. 0.243 64,494.524 ↑ 3.4 417 1

GroupAggregate (cost=298,367.43..298,392.39 rows=1,403 width=12) (actual time=64,494.168..64,494.524 rows=417 loops=1)

  • Group Key: draws_1.prod_user_id
67. 0.943 64,494.281 ↑ 1.3 1,096 1

Sort (cost=298,367.43..298,371.07 rows=1,458 width=4) (actual time=64,494.156..64,494.281 rows=1,096 loops=1)

  • Sort Key: draws_1.prod_user_id
  • Sort Method: quicksort Memory: 100kB
68. 64,493.338 64,493.338 ↑ 1.3 1,096 1

Index Scan using draws_special_draw_deal_status_idx on draws draws_1 (cost=0.42..298,290.81 rows=1,458 width=4) (actual time=53,489.639..64,493.338 rows=1,096 loops=1)

  • Filter: (((waiting_for)::text = 'R'::text) AND ((now() - '00:50:00'::interval) > deal_update_date))
  • Rows Removed by Filter: 155,710
Planning time : 303.590 ms
Execution time : 1,591,783.295 ms