explain.depesz.com

PostgreSQL's explain analyze made readable

Result: g7rm

Settings
# exclusive inclusive rows x rows loops node
1. 0.287 849.290 ↓ 19.0 76 1

Sort (cost=86,058.52..86,058.53 rows=4 width=3,280) (actual time=849.231..849.290 rows=76 loops=1)

  • Sort Key: company_contractor_positions.cps_name
  • Sort Method: quicksort Memory: 48kB
2. 0.248 849.003 ↓ 19.0 76 1

Group (cost=86,058.43..86,058.48 rows=4 width=3,280) (actual time=848.645..849.003 rows=76 loops=1)

  • Group Key: company_contractor_positions.cps_id, company_contractors.cc_id, professions.prof_id, company_contractor_join.ccj_id
3. 0.367 848.755 ↓ 19.0 76 1

Sort (cost=86,058.43..86,058.44 rows=4 width=3,272) (actual time=848.638..848.755 rows=76 loops=1)

  • Sort Key: company_contractor_positions.cps_id, company_contractors.cc_id, professions.prof_id, company_contractor_join.ccj_id
  • Sort Method: quicksort Memory: 47kB
4. 172.291 848.388 ↓ 19.0 76 1

Nested Loop Left Join (cost=81,579.25..86,058.39 rows=4 width=3,272) (actual time=335.782..848.388 rows=76 loops=1)

  • Join Filter: ((professions.prof_code)::text = (company_contractor_positions.cps_profession_code)::text)
  • Rows Removed by Join Filter: 214,059
5. 141.790 508.517 ↓ 76.0 76 1

Hash Right Join (cost=81,579.25..85,875.09 rows=1 width=2,748) (actual time=332.235..508.517 rows=76 loops=1)

  • Hash Cond: (company_contractor_join.ccj_contractor_fkey = company_contractors.cc_id)
  • Filter: ((((company_contractor_positions.cps_entity_type)::text = 'contractors'::text) AND (company_contractor_join.ccj_company_fkey = 1,534)) OR (((company_contractor_positions.cps_entity_type)::text = 'company'::text) AND (compan (...)
  • Rows Removed by Filter: 41,586
6. 85.641 85.641 ↑ 1.0 95,123 1

Seq Scan on company_contractor_join (cost=0.00..1,831.30 rows=95,130 width=24) (actual time=0.013..85.641 rows=95,123 loops=1)

7. 52.776 281.086 ↓ 11.4 31,142 1

Hash (cost=80,617.97..80,617.97 rows=2,742 width=2,740) (actual time=281.084..281.086 rows=31,142 loops=1)

  • Buckets: 1,024 (originally 1024) Batches: 8 (originally 4) Memory Usage: 2,614kB
8. 0.000 228.310 ↓ 11.4 31,142 1

Gather (cost=1,000.29..80,617.97 rows=2,742 width=2,740) (actual time=0.547..228.310 rows=31,142 loops=1)

  • Workers Planned: 4
  • Workers Launched: 4
9. 15.721 245.153 ↓ 9.1 6,228 5 / 5

Nested Loop Left Join (cost=0.29..79,343.77 rows=686 width=2,740) (actual time=0.125..245.153 rows=6,228 loops=5)

  • Join Filter: ((company_contractor_positions.cps_entity_type)::text = 'contractors'::text)
  • Rows Removed by Join Filter: 4
10. 173.376 173.376 ↓ 9.1 6,228 5 / 5

Parallel Seq Scan on company_contractor_positions (cost=0.00..78,308.49 rows=686 width=2,216) (actual time=0.024..173.376 rows=6,228 loops=5)

  • Filter: ((cps_deleted IS FALSE) AND (((cps_entity_type)::text = 'contractors'::text) OR (((cps_entity_type)::text = 'company'::text) AND (cps_entity_fkey = 1,534))))
  • Rows Removed by Filter: 41,457
11. 56.056 56.056 ↑ 1.0 1 31,142 / 5

Index Scan using company_contractors_cc_id_pkey on company_contractors (cost=0.29..1.50 rows=1 width=524) (actual time=0.009..0.009 rows=1 loops=31,142)

  • Index Cond: (company_contractor_positions.cps_entity_fkey = cc_id)
  • Filter: (cc_deleted IS FALSE)
  • Rows Removed by Filter: 0
12. 167.580 167.580 ↑ 1.7 2,817 76

Seq Scan on professions (cost=0.00..124.80 rows=4,680 width=1,040) (actual time=0.019..2.205 rows=2,817 loops=76)

Planning time : 0.330 ms
Execution time : 849.699 ms