explain.depesz.com

A tool for finding a real cause for slow queries.

Result: dwu4

options
Did it help? Consider supporting us - Bitcoin address: 12v2hUztAk2LgzQ9H9LMwuU32urHMjZQnq
# exclusive inclusive rows x rows loops node
1. 0.004 14636.873 ↓ 13.0 13 1

Limit (cost=44.44..44.44 rows=1 width=2776) (actual time=14636.870..14636.873 rows=13 loops=1)

2.          

CTE sources

3. 0.133 159.815 ↓ 18.0 18 1

Nested Loop (cost=0.00..12.16 rows=1 width=805) (actual time=35.300..159.815 rows=18 loops=1)

4. 52.924 52.924 ↓ 18.0 18 1

Index Scan using merit_account_source_map_account_group_idx on merit_account_source_map (cost=0.00..6.09 rows=1 width=12) (actual time=24.164..52.924 rows=18 loops=1)

  • Index Cond: ((account_id = 15022) AND (org_group_id = 14995))
  • Filter: (archive_p = 0)
5. 106.758 106.758 ↑ 1.0 1 18

Index Scan using pub_survey_sources_pub_survey_code_idx on pub_survey_sources (cost=0.00..6.06 rows=1 width=805) (actual time=5.930..5.931 rows=1 loops=18)

  • Index Cond: ((pub_survey_code)::text = (merit_account_source_map.pub_survey_code)::text)
  • Filter: active_p
6.          

CTE source_arr

7. 0.081 124.710 ↑ 1.0 1 1

Aggregate (cost=0.02..0.03 rows=1 width=218) (actual time=124.709..124.710 rows=1 loops=1)

8. 124.629 124.629 ↓ 18.0 18 1

CTE Scan on sources (cost=0.00..0.02 rows=1 width=218) (actual time=0.001..124.629 rows=18 loops=1)

9.          

CTE jobs

10. 0.066 14600.898 ↓ 13.0 13 1

Nested Loop (cost=0.00..32.17 rows=1 width=2321) (actual time=5191.869..14600.898 rows=13 loops=1)

11. 1.024 14529.241 ↓ 13.0 13 1

Nested Loop (cost=0.00..23.90 rows=1 width=1358) (actual time=5169.968..14529.241 rows=13 loops=1)

  • Join Filter: ((pub_survey_jobs.survey_code)::text = ANY ((s.surveys)::text[]))
12. 7.441 14403.012 ↓ 491.0 491 1

Nested Loop (cost=0.00..23.87 rows=1 width=1358) (actual time=369.664..14403.012 rows=491 loops=1)

13. 162.923 162.923 ↓ 1432.0 1432 1

Index Scan using merit_default_cut_map_key_idx on merit_default_cut_map (cost=0.00..6.37 rows=1 width=37) (actual time=26.932..162.923 rows=1432 loops=1)

  • Index Cond: ((organization_id IS NOT NULL) AND (organization_id = 15022) AND (org_group_id = 14995))
14. 14232.648 14232.648 ↓ 0.0 0 1432

Index Scan using pub_survey_jobs_sc_js_jc_un_idx on pub_survey_jobs (cost=0.00..17.49 rows=1 width=1346) (actual time=9.528..9.939 rows=0 loops=1432)

  • Index Cond: (((survey_code)::text = (merit_default_cut_map.survey_code)::text) AND ((job_scope)::text = (merit_default_cut_map.job_scope)::text))
  • Filter: (((job_title)::text ~~* '%org%dev%'::text) AND ((currency)::text = 'USD'::text))
15. 125.205 125.205 ↑ 1.0 1 491

CTE Scan on source_arr s (cost=0.00..0.02 rows=1 width=32) (actual time=0.255..0.255 rows=1 loops=491)

16. 71.591 71.591 ↑ 1.0 1 13

Index Scan using pub_survey_jobs_desc_sc_jc_idx on pub_survey_jobs_desc (cost=0.00..8.25 rows=1 width=998) (actual time=5.506..5.507 rows=1 loops=13)

  • Index Cond: (((survey_code)::text = (pub_survey_jobs.survey_code)::text) AND ((job_code)::text = (pub_survey_jobs.job_code)::text))
17. 0.087 14636.869 ↓ 13.0 13 1

Sort (cost=0.08..0.08 rows=1 width=2776) (actual time=14636.868..14636.869 rows=13 loops=1)

  • Sort Key: jobs.survey_code, jobs.job_code, jobs.job_scope
  • Sort Method: quicksort Memory: 51kB
18. 0.405 14636.782 ↓ 13.0 13 1

Nested Loop (cost=0.00..0.07 rows=1 width=2776) (actual time=14636.490..14636.782 rows=13 loops=1)

  • Join Filter: ((sources.pub_survey_code)::text = (jobs.survey_code)::text)
19. 35.317 35.317 ↓ 18.0 18 1

CTE Scan on sources (cost=0.00..0.02 rows=1 width=734) (actual time=35.308..35.317 rows=18 loops=1)

20. 14601.060 14601.060 ↓ 13.0 13 18

CTE Scan on jobs (cost=0.00..0.02 rows=1 width=2260) (actual time=288.438..811.170 rows=13 loops=18)