explain.depesz.com

PostgreSQL's explain analyze made readable

Result: BeMf : Optimization for: plan #NdCX

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.025 3.666 ↑ 1.1 114 1

Subquery Scan on cs (cost=2,637.43..2,638.60 rows=124 width=76) (actual time=3.325..3.666 rows=114 loops=1)

2. 0.257 3.641 ↑ 1.1 114 1

WindowAgg (cost=2,637.43..2,638.23 rows=124 width=132) (actual time=3.323..3.641 rows=114 loops=1)

3.          

CTE daily_sums

4. 0.909 3.205 ↑ 1.1 114 1

GroupAggregate (cost=2,631.85..2,635.82 rows=124 width=68) (actual time=2.126..3.205 rows=114 loops=1)

  • Group Key: sponsored_brands_daily_campaign_performances.date
5. 0.803 2.296 ↑ 1.1 1,524 1

Sort (cost=2,631.85..2,632.72 rows=1,737 width=13) (actual time=2.103..2.296 rows=1,524 loops=1)

  • Sort Key: sponsored_brands_daily_campaign_performances.date
  • Sort Method: quicksort Memory: 146kB
6. 1.264 1.493 ↑ 1.1 1,524 1

Bitmap Heap Scan on sponsored_brands_daily_campaign_performances (cost=30.78..2,613.16 rows=1,737 width=13) (actual time=0.309..1.493 rows=1,524 loops=1)

  • Recheck Cond: (profile_id = '3811963422597420'::bigint)
  • Heap Blocks: exact=330
7. 0.229 0.229 ↑ 1.1 1,622 1

Bitmap Index Scan on sb_daily_campaign_performances_profile_id_campaign_id_date_pkey (cost=0.00..30.69 rows=1,737 width=0) (actual time=0.229..0.229 rows=1,622 loops=1)

  • Index Cond: (profile_id = '3811963422597420'::bigint)
8. 0.064 3.384 ↑ 1.1 114 1

Group (cost=1.61..1.85 rows=124 width=68) (actual time=3.309..3.384 rows=114 loops=1)

  • Group Key: daily_sums.date, daily_sums.ad_spend, daily_sums.ad_revenue
9. 0.050 3.320 ↑ 1.1 114 1

Sort (cost=1.61..1.67 rows=124 width=68) (actual time=3.307..3.320 rows=114 loops=1)

  • Sort Key: daily_sums.date, daily_sums.ad_spend, daily_sums.ad_revenue
  • Sort Method: quicksort Memory: 33kB
10. 3.270 3.270 ↑ 1.1 114 1

CTE Scan on daily_sums (cost=0.00..0.74 rows=124 width=68) (actual time=2.129..3.270 rows=114 loops=1)

Planning time : 0.194 ms
Execution time : 3.770 ms