explain.depesz.com

PostgreSQL's explain analyze made readable

Result: NC3 : Craig's Query

Settings
# exclusive inclusive rows x rows loops node
1. 52.403 9,276.465 ↓ 4,285.0 4,285 1

Aggregate (cost=112091.08..112091.09 rows=1 width=13) (actual time=9277.093..9277.093 rows=1 loops=1)-> Merge Anti Join (cost=108,110.23..112,091.07 rows=1 width=13) (actual time=7,833.546..9,276.465 rows=4,285 loops=1)

  • Merge Cond: ((log_entries.mobile_number)::text = (log_entries_1.mobile_number)::text)
2. 25.818 42.904 ↓ 2.2 5,359 1

Sort (cost=1,889.31..1,895.39 rows=2,431 width=13) (actual time=42.010..42.904 rows=5,359 loops=1)

  • Sort Key: log_entries.mobile_number
  • Sort Method: quicksort Memory: 444kB
3. 7.293 17.086 ↓ 2.2 5,359 1

HashAggregate (cost=1,703.98..1,728.29 rows=2,431 width=13) (actual time=16.327..17.086 rows=5,359 loops=1)

4. 9.793 9.793 ↑ 1.0 30,447 1

Index Scan using log_entries_created_at_idx on log_entries (cost=0.42..1,626.37 rows=31,047 width=13) (actual time=0.021..9.793 rows=30,447 loops=1)

  • Index Cond: ((created_at >= '2015-04-09 00:00:00'::timestamp without time zone) AND (created_at <= '2015-04-09 23:59:59'::timestamp without time zone))
5. 9.273 9,181.158 ↓ 1.9 94,303 1

Materialize (cost=106,220.91..110,040.28 rows=50,005 width=13) (actual time=7,791.528..9,181.158 rows=94,303 loops=1)

6. 60.132 9,171.885 ↓ 1.9 94,303 1

Unique (cost=106,220.91..109,415.22 rows=50,005 width=13) (actual time=7,791.524..9,171.885 rows=94,303 loops=1)

7. 8,295.125 9,111.753 ↓ 1.0 641,412 1

Sort (cost=106,220.91..107,818.07 rows=638,861 width=13) (actual time=7,791.523..9,111.753 rows=641,412 loops=1)

  • Sort Key: log_entries_1.mobile_number
  • Sort Method: external merge Disk: 14408kB
8. 816.628 816.628 ↓ 1.0 641,412 1

Seq Scan on log_entries log_entries_1 (cost=0.00..22,778.29 rows=638,861 width=13) (actual time=41.285..816.628 rows=641,412 loops=1)

  • Filter: (created_at < '2015-04-09 00:00:00'::timestamp without time zone)
  • Rows Removed by Filter: 34691
Total runtime : 9,309.249 ms