explain.depesz.com

PostgreSQL's explain analyze made readable

Result: YKKW

Settings
# exclusive inclusive rows x rows loops node
1. 0.006 901.631 ↑ 51.0 2 1

GroupAggregate (cost=103,178.20..103,179.99 rows=102 width=12) (actual time=901.629..901.631 rows=2 loops=1)

  • Group Key: entity_values.value_company_id
2. 0.013 901.625 ↑ 51.0 2 1

Sort (cost=103,178.20..103,178.46 rows=102 width=4) (actual time=901.625..901.625 rows=2 loops=1)

  • Sort Key: entity_values.value_company_id
  • Sort Method: quicksort Memory: 25kB
3. 0.136 901.612 ↑ 51.0 2 1

Hash Join (cost=102,373.31..103,174.80 rows=102 width=4) (actual time=901.606..901.612 rows=2 loops=1)

  • Hash Cond: (entity_values.company_id = rows.id)
4. 0.009 0.023 ↑ 213.0 2 1

Bitmap Heap Scan on entity_values (cost=7.73..806.60 rows=426 width=8) (actual time=0.018..0.023 rows=2 loops=1)

  • Recheck Cond: (entity_attribute_id = 120416)
  • Heap Blocks: exact=2
5. 0.014 0.014 ↑ 213.0 2 1

Bitmap Index Scan on entity_values_entity_attribute_id_company_id_index (cost=0.00..7.62 rows=426 width=0) (actual time=0.014..0.014 rows=2 loops=1)

  • Index Cond: (entity_attribute_id = 120416)
6. 32.448 901.453 ↓ 3.4 89,515 1

Hash (cost=102,032.36..102,032.36 rows=26,658 width=4) (actual time=901.453..901.453 rows=89,515 loops=1)

  • Buckets: 131072 (originally 32768) Batches: 1 (originally 1) Memory Usage: 4172kB
7. 36.818 869.005 ↓ 3.4 89,515 1

Subquery Scan on rows (cost=15,846.74..102,032.36 rows=26,658 width=4) (actual time=58.968..869.005 rows=89,515 loops=1)

8. 308.212 832.187 ↓ 3.4 89,515 1

Hash Join (cost=15,846.74..101,765.78 rows=26,658 width=249) (actual time=58.967..832.187 rows=89,515 loops=1)

  • Hash Cond: (companies.id = organizations_relevant_companies.company_id)
9. 465.897 466.410 ↓ 2.0 889,922 1

Seq Scan on companies (cost=52.05..84,059.40 rows=438,695 width=4) (actual time=0.929..466.410 rows=889,922 loops=1)

  • Filter: (((organization_id IS NULL) OR (organization_id = 7)) AND (NOT (hashed SubPlan 1)))
  • Rows Removed by Filter: 636369
10.          

SubPlan (forSeq Scan)

11. 0.513 0.513 ↑ 1.0 1,032 1

Seq Scan on hidden_globals (cost=0.00..49.48 rows=1,032 width=4) (actual time=0.010..0.513 rows=1,032 loops=1)

  • Filter: (organization_id = 7)
  • Rows Removed by Filter: 1566
12. 26.925 57.565 ↑ 1.0 89,595 1

Hash (cost=14,635.36..14,635.36 rows=92,746 width=4) (actual time=57.565..57.565 rows=89,595 loops=1)

  • Buckets: 131072 Batches: 1 Memory Usage: 4174kB
13. 30.640 30.640 ↑ 1.0 89,595 1

Index Only Scan using organizations_relevant_companies_organization_id_company_id_idx on organizations_relevant_companies (cost=0.43..14,635.36 rows=92,746 width=4) (actual time=0.017..30.640 rows=89,595 loops=1)

  • Index Cond: (organization_id = 7)
  • Heap Fetches: 89595