explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ZNTo

Settings
# exclusive inclusive rows x rows loops node
1. 29,379.953 29,380.325 ↓ 0.0 39 1

Sort row IDs: <temporary>.name (cost=0..0 rows=0 width=0) (actual time=29,380.071..29,380.325 rows=39 loops=1)

2. 0.000 0.372 ↓ 0.0 39 1

Table scan on <temporary> (cost=0..0 rows=0 width=0) (actual time=0.014..0.372 rows=39 loops=1)

3. 1.344 29,379.710 ↓ 0.0 39 1

Temporary table (cost=0..0 rows=0 width=0) (actual time=29,378.868..29,379.710 rows=39 loops=1)

4. 7,277.738 29,378.366 ↓ 0.0 39 1

Group aggregate: count((case when (core_slackmessage.deleted = 0) then core_slackmessage.id else NULL end)) (cost=0..0 rows=0 width=0) (actual time=7,079.746..29,378.366 rows=39 loops=1)

5. 13,151.996 22,100.628 ↓ 0.0 811,073 1

Nested loop left join (cost=11908.01 rows=20019) (cost=0..0 rows=0 width=0) (actual time=0.315..22,100.628 rows=811,073 loops=1)

6. 1.089 2.656 ↓ 0.0 39 1

Filter: (core_slackchannel.archived = 0) (cost=22.72 rows=8) (cost=0..0 rows=0 width=0) (actual time=0.066..2.656 rows=39 loops=1)

7. 1.567 1.567 ↓ 0.0 78 1

Index lookup on core_slackchannel using core_slackchannel_team_id_22543859_fk_core_slackteam_id (team_id=11) (cost=22.72 rows=78) (cost=0..0 rows=0 width=0) (actual time=0.037..1.567 rows=78 loops=1)

8. 8,945.976 8,945.976 ↓ 0.0 20,797 39

Index lookup on core_slackmessage using core_slackmessage_channel_id_created_f5078a8c_uniq (channel_id=core_slackchannel.id) (cost=1300.00 rows=2567) (cost=0..0 rows=0 width=0) (actual time=0.276..229.384 rows=20,797 loops=39)