explain.depesz.com

PostgreSQL's explain analyze made readable

Result: c1aG : Survey with where fk_company

Settings
# exclusive inclusive rows x rows loops node
1. 0.059 492.719 ↑ 1.3 11 1

Hash Left Join (cost=319.26..31,172.59 rows=14 width=196) (actual time=482.844..492.719 rows=11 loops=1)

  • Hash Cond: (s.fk_place = p.id_place)
2. 0.380 492.329 ↑ 1.3 11 1

Nested Loop Left Join (cost=317.42..31,170.69 rows=14 width=164) (actual time=482.470..492.329 rows=11 loops=1)

  • Join Filter: (sa.fk_survey = s.id_survey)
  • Rows Removed by Join Filter: 1145
3. 0.936 476.516 ↑ 1.3 11 1

Nested Loop Left Join (cost=0.70..30,831.88 rows=14 width=156) (actual time=467.162..476.516 rows=11 loops=1)

  • Join Filter: (sr.fk_survey = s.id_survey)
  • Rows Removed by Join Filter: 2788
4. 8.971 8.971 ↑ 1.3 11 1

Index Scan using "IX_surveys_fk_place" on surveys s (cost=0.28..210.69 rows=14 width=148) (actual time=0.695..8.971 rows=11 loops=1)

  • Filter: ((deletedat IS NULL) AND (fk_company = '2'::numeric))
  • Rows Removed by Filter: 525
5. 0.386 466.609 ↓ 127.0 254 11

Materialize (cost=0.42..30,620.77 rows=2 width=13) (actual time=42.109..42.419 rows=254 loops=11)

6. 0.051 466.223 ↓ 127.0 254 1

Subquery Scan on sr (cost=0.42..30,620.76 rows=2 width=13) (actual time=463.181..466.223 rows=254 loops=1)

7. 274.054 466.172 ↓ 127.0 254 1

GroupAggregate (cost=0.42..30,620.74 rows=2 width=5) (actual time=463.179..466.172 rows=254 loops=1)

  • Group Key: sr_1.fk_survey
8. 192.118 192.118 ↓ 1.0 1,004,215 1

Index Only Scan using "IX_survey_responses_fk_survey" on survey_responses sr_1 (cost=0.42..25,725.65 rows=979,015 width=5) (actual time=1.063..192.118 rows=1,004,215 loops=1)

  • Heap Fetches: 0
9. 0.139 15.433 ↓ 1.1 105 11

Materialize (cost=316.72..319.10 rows=95 width=13) (actual time=1.386..1.403 rows=105 loops=11)

10. 0.020 15.294 ↓ 1.1 105 1

Subquery Scan on sa (cost=316.72..318.62 rows=95 width=13) (actual time=15.239..15.294 rows=105 loops=1)

11. 3.582 15.274 ↓ 1.1 105 1

HashAggregate (cost=316.72..317.67 rows=95 width=5) (actual time=15.238..15.274 rows=105 loops=1)

  • Group Key: sa_1.fk_survey
12. 11.692 11.692 ↑ 1.0 7,233 1

Seq Scan on survey_audiences sa_1 (cost=0.00..279.69 rows=7,407 width=5) (actual time=0.685..11.692 rows=7,233 loops=1)

  • Filter: (deletedat IS NULL)
  • Rows Removed by Filter: 61
13. 0.037 0.331 ↑ 1.0 37 1

Hash (cost=1.37..1.37 rows=37 width=64) (actual time=0.331..0.331 rows=37 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
14. 0.294 0.294 ↑ 1.0 37 1

Seq Scan on places p (cost=0.00..1.37 rows=37 width=64) (actual time=0.282..0.294 rows=37 loops=1)

Planning time : 23.035 ms
Execution time : 493.044 ms