explain.depesz.com

PostgreSQL's explain analyze made readable

Result: HRwl

Settings
# exclusive inclusive rows x rows loops node
1. 31.572 453.772 ↓ 0.0 0 1

Insert on companies_persons (cost=6,618.56..82,646.22 rows=28,438 width=16) (actual time=453.772..453.772 rows=0 loops=1)

  • Conflict Resolution: NOTHING
  • Tuples Inserted: 959
  • Conflicting Tuples: 49
2. 1.895 422.200 ↑ 28.2 1,008 1

Subquery Scan on *SELECT* (cost=6,618.56..82,646.22 rows=28,438 width=16) (actual time=1.187..422.200 rows=1,008 loops=1)

3. 3.381 420.305 ↑ 28.2 1,008 1

Nested Loop (cost=6,618.56..82,219.65 rows=28,438 width=12) (actual time=1.182..420.305 rows=1,008 loops=1)

4.          

CTE matching_companies

5. 5.970 6.315 ↓ 2.0 1,966 1

Index Scan using companies_pkey on companies (cost=98.29..6,600.26 rows=983 width=334) (actual time=0.694..6.315 rows=1,966 loops=1)

  • Index Cond: (id = ANY ('{219800348,219799862,219799452,219799009,219799453,219800349,1527568,2180191,219799876,219800350,219799310,205505799,219799455,219799879,1581887,219799881,219799882,219800476,219800353,219799$
  • Filter: (NOT (hashed SubPlan 1))
6.          

SubPlan (forIndex Scan)

7. 0.345 0.345 ↓ 0.0 0 1

Seq Scan on hidden_globals (cost=0.00..97.85 rows=5 width=4) (actual time=0.345..0.345 rows=0 loops=1)

  • Filter: (organization_id = 9)
  • Rows Removed by Filter: 5094
8. 7.996 7.996 ↓ 2.0 1,966 1

CTE Scan on matching_companies (cost=0.00..19.66 rows=983 width=36) (actual time=0.695..7.996 rows=1,966 loops=1)

9. 408.928 408.928 ↑ 29.0 1 1,966

Bitmap Heap Scan on persons (cost=18.30..76.62 rows=29 width=48) (actual time=0.208..0.208 rows=1 loops=1,966)

  • Recheck Cond: ((organization_id = 9) AND (email_domains @> ARRAY[matching_companies.domain]))
  • Heap Blocks: exact=1008
  • -> Bitmap Index Scan on persons_organization_id_email_domains_index (cost=0.00..18.29 rows=29 width=0) (actual time=0.206..0.206 rows=1 loops=1966)Index Cond: ((organization_id = 9) AND (email_domains @> ARRAY[matching_companies.domain]))