explain.depesz.com

PostgreSQL's explain analyze made readable

Result: EwDb

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 4,611.878 ↓ 21.0 21 1

Limit (cost=7,034.15..7,034.16 rows=1 width=22) (actual time=4,611.876..4,611.878 rows=21 loops=1)

2. 0.016 4,611.876 ↓ 21.0 21 1

Sort (cost=7,034.15..7,034.16 rows=1 width=22) (actual time=4,611.875..4,611.876 rows=21 loops=1)

  • Sort Key: (count(*)) DESC
  • Sort Method: top-N heapsort Memory: 27kB
3. 0.040 4,611.860 ↓ 61.0 61 1

GroupAggregate (cost=7,034.12..7,034.14 rows=1 width=22) (actual time=4,611.820..4,611.860 rows=61 loops=1)

  • Group Key: entity_values.value_text
4. 0.350 4,611.820 ↓ 192.0 192 1

Sort (cost=7,034.12..7,034.13 rows=1 width=14) (actual time=4,611.812..4,611.820 rows=192 loops=1)

  • Sort Key: entity_values.value_text
  • Sort Method: quicksort Memory: 37kB
5. 15.004 4,611.470 ↓ 192.0 192 1

Nested Loop (cost=6,777.77..7,034.11 rows=1 width=14) (actual time=144.541..4,611.470 rows=192 loops=1)

6. 30.250 479.746 ↓ 48,432.0 48,432 1

Nested Loop (cost=6,777.20..7,029.50 rows=1 width=305) (actual time=144.440..479.746 rows=48,432 loops=1)

7. 26.031 158.802 ↓ 880.9 48,449 1

HashAggregate (cost=6,776.63..6,777.18 rows=55 width=4) (actual time=144.420..158.802 rows=48,449 loops=1)

  • Group Key: entity_values_1.person_id
8. 53.112 132.771 ↓ 880.9 48,449 1

Bitmap Heap Scan on entity_values entity_values_1 (cost=6,738.21..6,776.50 rows=55 width=4) (actual time=82.904..132.771 rows=48,449 loops=1)

  • Recheck Cond: ((entity_attribute_id = 72,323) AND (org_id = 2,310) AND (person_id IS NOT NULL))
  • Filter: ((value_location).country = 'United States'::text)
  • Rows Removed by Filter: 14,875
  • Heap Blocks: exact=24,520
9. 1.619 79.659 ↓ 0.0 0 1

BitmapAnd (cost=6,738.21..6,738.21 rows=19 width=0) (actual time=79.659..79.659 rows=0 loops=1)

10. 5.091 5.091 ↓ 5.8 63,324 1

Bitmap Index Scan on entity_values_entity_attribute_id_company_id_index (cost=0.00..164.52 rows=10,926 width=0) (actual time=5.091..5.091 rows=63,324 loops=1)

  • Index Cond: (entity_attribute_id = 72,323)
11. 72.949 72.949 ↓ 1.3 632,675 1

Bitmap Index Scan on entity_values_org_id_person_id_index (cost=0.00..6,573.41 rows=498,246 width=0) (actual time=72.949..72.949 rows=632,675 loops=1)

  • Index Cond: (org_id = 2,310)
12. 290.694 290.694 ↑ 1.0 1 48,449

Index Scan using persons_id_index on persons (cost=0.56..4.59 rows=1 width=4) (actual time=0.006..0.006 rows=1 loops=48,449)

  • Index Cond: (id = entity_values_1.person_id)
  • Filter: ((org_id = 2,310) AND (type = 0))
  • Rows Removed by Filter: 0
13. 4,116.720 4,116.720 ↓ 0.0 0 48,432

Index Scan using entity_values_org_id_person_id_index on entity_values (cost=0.57..4.59 rows=1 width=18) (actual time=0.085..0.085 rows=0 loops=48,432)

  • Index Cond: ((org_id = 2,310) AND (person_id = persons.id))
  • Filter: ((value_text ~* '\mAngel'::text) AND (entity_attribute_id = 72,320))
  • Rows Removed by Filter: 8
Planning time : 0.749 ms
Execution time : 4,615.444 ms