explain.depesz.com

PostgreSQL's explain analyze made readable

Result: xhJJy

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.077 41.371 ↓ 10.1 81 1

WindowAgg (cost=374,496.07..374,496.39 rows=8 width=68) (actual time=41.337..41.371 rows=81 loops=1)

2. 0.149 41.294 ↓ 10.1 81 1

GroupAggregate (cost=374,496.07..374,496.29 rows=8 width=60) (actual time=41.141..41.294 rows=81 loops=1)

  • Group Key: d.keyword_id, d.account_id, d.campaign_id, d.ad_group_id
3. 0.048 41.145 ↓ 10.1 81 1

Sort (cost=374,496.07..374,496.09 rows=8 width=28) (actual time=41.128..41.145 rows=81 loops=1)

  • Sort Key: d.keyword_id, d.account_id, d.campaign_id, d.ad_group_id
  • Sort Method: quicksort Memory: 31kB
4. 0.031 41.097 ↓ 10.1 81 1

Subquery Scan on d (cost=374,495.71..374,495.95 rows=8 width=28) (actual time=40.127..41.097 rows=81 loops=1)

5. 41.066 41.066 ↓ 10.1 81 1

CTE Scan on data (cost=374,495.71..374,495.87 rows=8 width=60) (actual time=40.126..41.066 rows=81 loops=1)

6.          

CTE data

7. 0.459 40.995 ↓ 10.1 81 1

Group (cost=374,495.63..374,495.71 rows=8 width=60) (actual time=40.123..40.995 rows=81 loops=1)

  • Group Key: d_1.keyword_id, d_1.campaign_id, d_1.ad_group_id
8. 1.045 40.536 ↓ 219.4 1,755 1

Sort (cost=374,495.63..374,495.65 rows=8 width=24) (actual time=40.122..40.536 rows=1,755 loops=1)

  • Sort Key: d_1.keyword_id, d_1.ad_group_id
  • Sort Method: quicksort Memory: 186kB
9. 0.654 39.491 ↓ 219.4 1,755 1

Append (cost=0.00..374,495.51 rows=8 width=24) (actual time=4.648..39.491 rows=1,755 loops=1)

10. 0.001 0.001 ↓ 0.0 0 1

Seq Scan on yandex_direct_keyword d_1 (cost=0.00..0.00 rows=1 width=24) (actual time=0.001..0.001 rows=0 loops=1)

  • Filter: ((date >= '2018-11-01'::date) AND (date <= '2018-11-30'::date) AND (account_id = 1) AND (campaign_id = 35227015))
11. 8.317 12.557 ↓ 109.0 436 1

Bitmap Heap Scan on data_yandex_direct_keyword_2018_11_0 d_2 (cost=3,135.59..274,678.41 rows=4 width=24) (actual time=4.646..12.557 rows=436 loops=1)

  • Recheck Cond: ((account_id = 1) AND (date >= '2018-11-01'::date) AND (date <= '2018-11-30'::date))
  • Filter: (campaign_id = 35227015)
  • Rows Removed by Filter: 56113
  • Heap Blocks: exact=1187
12. 4.240 4.240 ↑ 1.5 56,549 1

Bitmap Index Scan on data_yandex_direct_keyword_2018_11_0_account_id_date_idx (cost=0.00..3,135.59 rows=84,402 width=0) (actual time=4.240..4.240 rows=56,549 loops=1)

  • Index Cond: ((account_id = 1) AND (date >= '2018-11-01'::date) AND (date <= '2018-11-30'::date))
13. 5.109 7.756 ↓ 320.0 320 1

Bitmap Heap Scan on data_yandex_direct_keyword_2018_11_1 d_3 (cost=306.28..31,300.46 rows=1 width=24) (actual time=2.961..7.756 rows=320 loops=1)

  • Recheck Cond: ((account_id = 1) AND (date >= '2018-11-01'::date) AND (date <= '2018-11-30'::date))
  • Filter: (campaign_id = 35227015)
  • Rows Removed by Filter: 35208
  • Heap Blocks: exact=696
14. 2.647 2.647 ↓ 4.4 35,528 1

Bitmap Index Scan on data_yandex_direct_keyword_2018_11_1_account_id_date_idx (cost=0.00..306.28 rows=8,137 width=0) (actual time=2.647..2.647 rows=35,528 loops=1)

  • Index Cond: ((account_id = 1) AND (date >= '2018-11-01'::date) AND (date <= '2018-11-30'::date))
15. 4.489 6.829 ↓ 422.0 422 1

Bitmap Heap Scan on data_yandex_direct_keyword_2018_11_2 d_4 (cost=295.79..29,350.11 rows=1 width=24) (actual time=2.670..6.829 rows=422 loops=1)

  • Recheck Cond: ((account_id = 1) AND (date >= '2018-11-01'::date) AND (date <= '2018-11-30'::date))
  • Filter: (campaign_id = 35227015)
  • Rows Removed by Filter: 31166
  • Heap Blocks: exact=629
16. 2.340 2.340 ↓ 4.1 31,588 1

Bitmap Index Scan on data_yandex_direct_keyword_2018_11_2_account_id_date_idx (cost=0.00..295.79 rows=7,618 width=0) (actual time=2.340..2.340 rows=31,588 loops=1)

  • Index Cond: ((account_id = 1) AND (date >= '2018-11-01'::date) AND (date <= '2018-11-30'::date))
17. 7.082 11.694 ↓ 577.0 577 1

Bitmap Heap Scan on data_yandex_direct_keyword_2018_11_3 d_5 (cost=399.43..39,166.52 rows=1 width=24) (actual time=5.393..11.694 rows=577 loops=1)

  • Recheck Cond: ((account_id = 1) AND (date >= '2018-11-01'::date) AND (date <= '2018-11-30'::date))
  • Filter: (campaign_id = 35227015)
  • Rows Removed by Filter: 48283
  • Heap Blocks: exact=1194
18. 4.612 4.612 ↓ 6.1 62,101 1

Bitmap Index Scan on data_yandex_direct_keyword_2018_11_3_account_id_date_idx (cost=0.00..399.43 rows=10,149 width=0) (actual time=4.612..4.612 rows=62,101 loops=1)

  • Index Cond: ((account_id = 1) AND (date >= '2018-11-01'::date) AND (date <= '2018-11-30'::date))