explain.depesz.com

PostgreSQL's explain analyze made readable

Result: HcFC

Settings
# exclusive inclusive rows x rows loops node
1. 170.315 1,717.497 ↑ 1.0 10 1

Limit (cost=185,688.01..185,688.04 rows=10 width=63) (actual time=1,547.188..1,717.497 rows=10 loops=1)

  • Buffers: shared hit=1280476
2.          

CTE excluded

3. 0.801 40.377 ↑ 1.5 52 1

Nested Loop (cost=0.86..840.50 rows=78 width=16) (actual time=0.220..40.377 rows=52 loops=1)

  • Buffers: shared hit=6542
4. 16.672 16.672 ↓ 6.9 1,636 1

Index Scan using connection_group on connections con (cost=0.43..261.59 rows=238 width=16) (actual time=0.089..16.672 rows=1,636 loops=1)

  • Index Cond: (groupid = 'cb3fdb47-f5e2-46ef-bcdc-9867ca05daf5'::uuid)
  • Filter: (NOT deleted)
  • Rows Removed by Filter: 2
  • Buffers: shared hit=1576
5. 22.904 22.904 ↓ 0.0 0 1,636

Index Scan using companyaccountconnections_pkey on companyaccountconnections cac (cost=0.43..2.43 rows=1 width=32) (actual time=0.014..0.014 rows=0 loops=1,636)

  • Index Cond: (connectionid = con.id)
  • Buffers: shared hit=4966
6. 232.547 1,547.182 ↑ 30,857.9 10 1

Sort (cost=184,847.51..185,618.96 rows=308,579 width=63) (actual time=1,547.181..1,547.182 rows=10 loops=1)

  • Sort Key: companies.name
  • Sort Method: top-N heapsort Memory: 26kB
  • Buffers: shared hit=1280476
7. 0.000 1,314.635 ↓ 1.0 311,839 1

Hash Anti Join (cost=1,002.97..178,179.23 rows=308,579 width=63) (actual time=40.993..1,314.635 rows=311,839 loops=1)

  • Hash Cond: (companies.id = x.to_companyaccountid)
  • Buffers: shared hit=1280473
8. 116.244 1,380.577 ↓ 1.0 311,875 1

Gather (cost=1,000.43..174,280.87 rows=308,583 width=47) (actual time=0.530..1,380.577 rows=311,875 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
  • Buffers: shared hit=1273928
9. 1,087.396 1,264.333 ↑ 1.2 103,958 3

Nested Loop (cost=0.43..142,422.57 rows=128,576 width=47) (actual time=0.102..1,264.333 rows=103,958 loops=3)

  • Buffers: shared hit=1273928
10. 176.927 176.927 ↑ 1.2 103,958 3

Parallel Seq Scan on companyaccounts (cost=0.00..35,567.64 rows=128,576 width=16) (actual time=0.024..176.927 rows=103,958 loops=3)

  • Filter: ((state)::text = 'ACTIVE'::text)
  • Rows Removed by Filter: 651162
  • Buffers: shared hit=23799
11. 0.010 0.010 ↑ 1.0 1 311,875

Index Scan using tenantinfos_pkey on companies (cost=0.43..0.83 rows=1 width=47) (actual time=0.010..0.010 rows=1 loops=311,875)

  • Index Cond: (id = companyaccounts.companyid)
  • Buffers: shared hit=1250129
12. 0.026 40.435 ↑ 1.5 52 1

Hash (cost=1.56..1.56 rows=78 width=16) (actual time=40.435..40.435 rows=52 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 11kB
  • Buffers: shared hit=6542
13. 40.409 40.409 ↑ 1.5 52 1

CTE Scan on excluded x (cost=0.00..1.56 rows=78 width=16) (actual time=0.221..40.409 rows=52 loops=1)

  • Buffers: shared hit=6542
Planning time : 2.000 ms
Execution time : 1,717.704 ms