explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 9BuG : daily_headers

Settings
# exclusive inclusive rows x rows loops node
1. 23,547.494 112,964.610 ↓ 0.0 0 1

Insert on daily_headers (cost=2,100,125.29..2,346,697.80 rows=672,798 width=219) (actual time=112,964.610..112,964.610 rows=0 loops=1)

2. 5,855.450 89,417.116 ↑ 1.3 521,715 1

Subquery Scan on *SELECT* (cost=2,100,125.29..2,346,697.80 rows=672,798 width=219) (actual time=68,423.976..89,417.116 rows=521,715 loops=1)

3. 14,317.811 83,561.666 ↑ 1.3 521,715 1

GroupAggregate (cost=2,100,125.29..2,333,241.84 rows=672,798 width=219) (actual time=68,423.947..83,561.666 rows=521,715 loops=1)

  • Group Key: fact.day_id, fact.account_slug, fact.mpi_key, fact.sender_domain, fact.header_id
4. 62,719.329 69,243.855 ↑ 1.9 5,178,562 1

Sort (cost=2,100,125.29..2,124,532.02 rows=9,762,693 width=239) (actual time=68,423.879..69,243.855 rows=5,178,562 loops=1)

  • Sort Key: fact.account_slug, fact.mpi_key, fact.sender_domain, fact.header_id
  • Sort Method: quicksort Memory: 1813156kB
5. 1,214.363 6,524.526 ↑ 1.9 5,178,562 1

Merge Right Join (cost=154,731.78..337,494.88 rows=9,762,693 width=239) (actual time=4,551.321..6,524.526 rows=5,178,562 loops=1)

  • Merge Cond: ((gm.mailbox_slug)::text = (fact.mailbox_slug)::text)
6. 418.810 418.810 ↓ 1.0 924,827 1

Index Scan using index_group_memberships_on_mailbox_slug on group_memberships gm (cost=0.42..34,065.46 rows=903,069 width=50) (actual time=0.007..418.810 rows=924,827 loops=1)

7. 2,446.835 4,891.353 ↓ 7.7 5,178,562 1

Sort (cost=154,731.35..156,413.35 rows=672,798 width=216) (actual time=4,551.304..4,891.353 rows=5,178,562 loops=1)

  • Sort Key: fact.mailbox_slug
  • Sort Method: quicksort Memory: 189342kB
8. 2,444.518 2,444.518 ↑ 1.3 521,715 1

Index Scan using message_facts_day_id_idx on message_facts fact (cost=0.43..89,605.13 rows=672,798 width=216) (actual time=1.244..2,444.518 rows=521,715 loops=1)

  • Index Cond: (day_id = 20200101)
  • Filter: ((heimdall_result)::text <> 'GlobalKnownGoodResult'::text)
  • Rows Removed by Filter: 665742
Planning time : 0.511 ms
Execution time : 112,976.745 ms