explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Qw5O

Settings
# exclusive inclusive rows x rows loops node
1. 0.010 679.927 ↓ 3.7 11 1

Sort (cost=138,204.86..138,204.87 rows=3 width=40) (actual time=679.926..679.927 rows=11 loops=1)

  • Sort Key: de.event_timestamp
  • Sort Method: quicksort Memory: 28kB
2.          

CTE first_event

3. 419.550 633.157 ↑ 100.0 38,768 1

ProjectSet (cost=10,839.21..31,579.55 rows=3,876,700 width=59) (actual time=118.150..633.157 rows=38,768 loops=1)

4. 37.617 213.607 ↓ 1.0 38,768 1

WindowAgg (cost=10,839.21..11,711.47 rows=38,767 width=321) (actual time=118.132..213.607 rows=38,768 loops=1)

5. 167.995 175.990 ↓ 1.0 38,768 1

Sort (cost=10,839.21..10,936.13 rows=38,767 width=313) (actual time=118.117..175.990 rows=38,768 loops=1)

  • Sort Key: de_1.event_id, de_1.type, de_1.event_timestamp
  • Sort Method: external merge Disk: 12,440kB
6. 7.995 7.995 ↓ 1.0 38,768 1

Seq Scan on demuxed_events de_1 (cost=0.00..2,186.67 rows=38,767 width=313) (actual time=0.005..7.995 rows=38,768 loops=1)

7. 0.060 679.917 ↓ 3.7 11 1

Nested Loop (cost=4.32..106,625.29 rows=3 width=40) (actual time=369.343..679.917 rows=11 loops=1)

8. 679.820 679.820 ↑ 1.0 1 1

CTE Scan on first_event fe (cost=0.00..106,609.25 rows=1 width=118) (actual time=369.291..679.820 rows=1 loops=1)

  • Filter: (((event_id)::text = '107502706'::text) AND (rk = 1) AND (name = 'packageCreated'::text))
  • Rows Removed by Filter: 38,767
9. 0.011 0.037 ↓ 3.7 11 1

Bitmap Heap Scan on demuxed_events de (cost=4.32..16.00 rows=3 width=309) (actual time=0.033..0.037 rows=11 loops=1)

  • Recheck Cond: ((type = 'package'::aggregate_root_entity_type) AND ((event_id)::text = '107502706'::text))
  • Heap Blocks: exact=2
10. 0.026 0.026 ↓ 3.7 11 1

Bitmap Index Scan on type_and_event_id (cost=0.00..4.32 rows=3 width=0) (actual time=0.026..0.026 rows=11 loops=1)

  • Index Cond: ((type = 'package'::aggregate_root_entity_type) AND ((event_id)::text = '107502706'::text))
Planning time : 0.228 ms
Execution time : 682.918 ms