explain.depesz.com

PostgreSQL's explain analyze made readable

Result: C73rA

Settings
# exclusive inclusive rows x rows loops node
1. 951.607 951.607 ↑ 6.0 6 1

CTE Scan on ntfsquery (cost=4,274.38..4,275.10 rows=36 width=202) (actual time=951.354..951.607 rows=6 loops=1)

2.          

CTE ntfsquery

3. 0.161 951.353 ↑ 6.0 6 1

Sort (cost=4,274.29..4,274.38 rows=36 width=99) (actual time=951.352..951.353 rows=6 loops=1)

  • Sort Key: notificationsettings.id
  • Sort Method: quicksort Memory: 410kB
4. 910.190 951.192 ↑ 6.0 6 1

HashAggregate (cost=4,273.00..4,273.36 rows=36 width=99) (actual time=951.172..951.192 rows=6 loops=1)

  • Group Key: notificationsettings.id, ntfs.sendalarmemailstoadditionalusers, ntfs.sendtoauthorizedusers
5. 2.562 41.002 ↓ 1.6 6,743 1

Hash Join (cost=4,026.10..4,230.88 rows=4,212 width=99) (actual time=36.740..41.002 rows=6,743 loops=1)

  • Hash Cond: (notificationsettingsdvrandmch.notificationsettings_id = notificationsettings.id)
6. 1.751 1.751 ↓ 1.1 6,743 1

Seq Scan on notificationsettingsdvrandmch (cost=0.00..138.97 rows=6,318 width=24) (actual time=0.041..1.751 rows=6,743 loops=1)

  • Filter: ((NOT isdeleted) AND (NOT isdeleted))
  • Rows Removed by Filter: 454
7. 0.229 36.689 ↓ 1.2 7 1

Hash (cost=4,026.03..4,026.03 rows=6 width=83) (actual time=36.689..36.689 rows=7 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 350kB
8. 0.101 36.460 ↓ 1.2 7 1

Merge Left Join (cost=4,025.93..4,026.03 rows=6 width=83) (actual time=36.360..36.460 rows=7 loops=1)

  • Merge Cond: (notificationsettings.id = ntfs.id)
9. 0.006 0.010 ↓ 1.2 7 1

Sort (cost=1.17..1.18 rows=6 width=19) (actual time=0.010..0.010 rows=7 loops=1)

  • Sort Key: notificationsettings.id
  • Sort Method: quicksort Memory: 25kB
10. 0.004 0.004 ↓ 1.2 7 1

Seq Scan on notificationsettings (cost=0.00..1.09 rows=6 width=19) (actual time=0.003..0.004 rows=7 loops=1)

  • Filter: (NOT isdeleted)
  • Rows Removed by Filter: 2
11. 0.121 36.349 ↓ 1.2 7 1

Sort (cost=4,024.76..4,024.77 rows=6 width=72) (actual time=36.348..36.349 rows=7 loops=1)

  • Sort Key: ntfs.id
  • Sort Method: quicksort Memory: 374kB
12. 0.002 36.228 ↓ 1.2 7 1

Subquery Scan on ntfs (cost=4,024.53..4,024.68 rows=6 width=72) (actual time=35.726..36.228 rows=7 loops=1)

13. 4.073 36.226 ↓ 1.2 7 1

HashAggregate (cost=4,024.53..4,024.62 rows=6 width=36) (actual time=35.725..36.226 rows=7 loops=1)

  • Group Key: notificationsettings_1.id
14. 7.146 32.153 ↓ 16.9 10,118 1

Hash Right Join (cost=2,024.06..4,020.03 rows=600 width=36) (actual time=21.378..32.153 rows=10,118 loops=1)

  • Hash Cond: (usv2.user_id = a.nr)
15. 3.639 3.639 ↑ 1.1 10,500 1

Seq Scan on users_v2 usv2 (cost=0.00..1,869.99 rows=11,998 width=14) (actual time=0.005..3.639 rows=10,500 loops=1)

  • Filter: ((NOT isdeleted) AND (user_id <> 'dummy'::text))
  • Rows Removed by Filter: 1
16. 2.359 21.368 ↓ 16.9 10,118 1

Hash (cost=2,016.56..2,016.56 rows=600 width=54) (actual time=21.368..21.368 rows=10,118 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 681kB
17. 8.563 19.009 ↓ 16.9 10,118 1

Hash Right Join (cost=20.59..2,016.56 rows=600 width=54) (actual time=5.517..19.009 rows=10,118 loops=1)

  • Hash Cond: (users_v2.user_id = a.elem)
18. 4.936 4.936 ↑ 1.1 10,500 1

Seq Scan on users_v2 (cost=0.00..1,869.99 rows=11,998 width=14) (actual time=0.005..4.936 rows=10,500 loops=1)

  • Filter: ((NOT isdeleted) AND (user_id <> 'dummy'::text))
  • Rows Removed by Filter: 1
19. 1.950 5.510 ↓ 16.9 10,118 1

Hash (cost=13.10..13.10 rows=600 width=72) (actual time=5.510..5.510 rows=10,118 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 681kB
20. 0.763 3.560 ↓ 16.9 10,118 1

Nested Loop (cost=0.01..13.10 rows=600 width=72) (actual time=0.016..3.560 rows=10,118 loops=1)

21. 0.004 0.004 ↓ 1.2 7 1

Seq Scan on notificationsettings notificationsettings_1 (cost=0.00..1.09 rows=6 width=52) (actual time=0.001..0.004 rows=7 loops=1)

  • Filter: (NOT isdeleted)
  • Rows Removed by Filter: 2
22. 2.793 2.793 ↓ 14.4 1,445 7

Function Scan on a (cost=0.01..1.00 rows=100 width=64) (actual time=0.267..0.399 rows=1,445 loops=7)

Planning time : 1.040 ms
Execution time : 952.770 ms