explain.depesz.com

PostgreSQL's explain analyze made readable

Result: UICN : Optimization for: plan #DWKm

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.199 2,557.932 ↑ 693.4 119 1

Unique (cost=411,743.77..431,135.03 rows=82,516 width=2,756) (actual time=2,557.683..2,557.932 rows=119 loops=1)

2. 0.526 2,557.733 ↑ 693.4 119 1

Sort (cost=411,743.77..411,950.06 rows=82,516 width=2,756) (actual time=2,557.682..2,557.733 rows=119 loops=1)

  • Sort Key: core_offer.id, core_offer.ecpc, core_offer.ecpc_prev, core_offer.conversion_rate, core_offer.conversion_rate_prev, core_offer.name, core_offer.name_ru, core_offer.name_en, core_offer.alternative_name, core_offer.alternative_name_ru, core_offer.alternative_name_en, core_offer.search_options, core_offer.slug, core_offer.product_id, core_offer.site_url, core_offer.currency_id, core_offer.created_dt, core_offer.publish_dt, core_offer.publisher_id, core_offer.advertiser_id, core_offer.need_flow_moderation, core_offer.is_active, core_offer.is_pre_closing, core_offer.logo, core_offer.description, core_offer.description_ru, core_offer.description_en, core_offer.seo_text, core_offer.seo_text_ru, core_offer.seo_text_en, core_offer.rules, core_offer.rules_ru, core_offer.rules_en, core_offer.min_access_level, core_offer.min_access_level_without_moderation, core_offer.cookie_ttl, core_offer.confirm_rate, core_offer.avg_processing, core_offer.count_active_flows, core_offer.is_hidden, core_offer.conversion_limit, core_offer.conversion_limit_currency_id, core_offer.disabled_until_dt, core_offer.flow_limit, core_offer.flow_limit_type, core_offer.is_exclusive, core_offer.bonus_inducing, (sum(CASE WHEN (core_flow.wm_id = 7716) THEN 1 ELSE 0 END)), (sum(CASE WHEN (core_channel_wm.user_id = 7716) THEN 1 ELSE 0 END)), core_currency.id, core_currency.update_dt, core_currency.char_code, core_currency.name, core_currency.name_ru, core_currency.name_en, core_currency.value, core_currency.min_reserve_amount, core_currency.is_visible, core_publisher.id, core_publisher.name, core_publisher.name_ru, core_publisher.name_en, t9.password, t9.last_login, t9.is_superuser, t9.email, t9.first_name, t9.last_name, t9.is_staff, t9.is_active, t9.date_joined, t9.date_bonus_activated, t9.email_is_confirmed, t9.default_currency_id, t9.phone, t9.role, t9.access_level, t9.manager_id, t9.manager_comment, t9.have_own_partner_program, t9.work_with_another_cpa_systems, t9.receive_notifications, t9.referrer_id, t9.referral_prc, t9.http_referrer, t9.billing_day, t9.cashout_available, t9.zaleycash_bonus, t9.vk, t9.fb, t9.telegram, t9.skype, t9.ga_cid
  • Sort Method: quicksort Memory: 368kB
3. 168.609 2,557.207 ↑ 693.4 119 1

GroupAggregate (cost=205,197.42..208,704.35 rows=82,516 width=2,756) (actual time=2,136.330..2,557.207 rows=119 loops=1)

  • Group Key: core_offer.id, core_currency.id, core_publisher.id, t9.id
  • Filter: ((NOT core_offer.is_hidden) OR (sum(CASE WHEN (core_channel_wm.user_id = 7716) THEN 1 ELSE 0 END) > 0) OR (sum(CASE WHEN (core_flow.wm_id = 7716) THEN 1 ELSE 0 END) > 0))
  • Rows Removed by Filter: 94
4. 2,056.138 2,388.598 ↓ 3.7 302,604 1

Sort (cost=205,197.42..205,403.71 rows=82,516 width=2,748) (actual time=2,118.825..2,388.598 rows=302,604 loops=1)

  • Sort Key: core_offer.id, core_currency.id, core_publisher.id, t9.id
  • Sort Method: external merge Disk: 578856kB
5. 309.639 332.460 ↓ 3.7 302,604 1

Hash Right Join (cost=1,068.66..2,725.00 rows=82,516 width=2,748) (actual time=16.696..332.460 rows=302,604 loops=1)

  • Hash Cond: (core_flow.offer_id = core_offer.id)
6. 6.168 6.168 ↓ 1.0 25,389 1

Seq Scan on core_flow (cost=0.00..610.14 rows=25,214 width=8) (actual time=0.018..6.168 rows=25,389 loops=1)

7. 4.646 16.653 ↓ 1.2 1,122 1

Hash (cost=1,056.87..1,056.87 rows=943 width=2,744) (actual time=16.653..16.653 rows=1,122 loops=1)

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 2197kB
8. 2.680 12.007 ↓ 1.2 1,122 1

Hash Right Join (cost=1,020.63..1,056.87 rows=943 width=2,744) (actual time=9.071..12.007 rows=1,122 loops=1)

  • Hash Cond: (core_channel_wm.channel_id = core_channel.id)
9. 0.291 0.291 ↑ 1.0 1,316 1

Seq Scan on core_channel_wm (cost=0.00..21.68 rows=1,368 width=8) (actual time=0.013..0.291 rows=1,316 loops=1)

10. 3.293 9.036 ↓ 1.3 758 1

Hash (cost=1,013.33..1,013.33 rows=584 width=2,744) (actual time=9.036..9.036 rows=758 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 1486kB
11. 1.848 5.743 ↓ 1.3 758 1

Hash Right Join (cost=989.05..1,013.33 rows=584 width=2,744) (actual time=3.743..5.743 rows=758 loops=1)

  • Hash Cond: (core_channel.offer_id = core_offer.id)
12. 0.192 0.192 ↓ 1.0 840 1

Seq Scan on core_channel (cost=0.00..15.32 rows=832 width=8) (actual time=0.016..0.192 rows=840 loops=1)

13. 1.134 3.703 ↓ 1.1 213 1

Hash (cost=986.53..986.53 rows=202 width=2,740) (actual time=3.703..3.703 rows=213 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 416kB
14. 0.157 2.569 ↓ 1.1 213 1

Nested Loop (cost=5.31..986.53 rows=202 width=2,740) (actual time=0.213..2.569 rows=213 loops=1)

15. 0.200 1.347 ↓ 1.1 213 1

Hash Left Join (cost=5.03..111.91 rows=202 width=2,273) (actual time=0.200..1.347 rows=213 loops=1)

  • Hash Cond: (core_offer.publisher_id = core_publisher.id)
16. 0.213 1.079 ↓ 1.1 213 1

Hash Left Join (cost=2.79..107.45 rows=202 width=1,733) (actual time=0.111..1.079 rows=213 loops=1)

  • Hash Cond: (core_offer.currency_id = core_currency.id)
17. 0.808 0.808 ↓ 1.1 213 1

Seq Scan on core_offer (cost=0.00..102.04 rows=202 width=1,626) (actual time=0.030..0.808 rows=213 loops=1)

  • Filter: (is_active AND (publish_dt <= '2019-02-06 16:59:25.958606+00'::timestamp with time zone) AND ((disabled_until_dt IS NULL) OR (disabled_until_dt < '2019-02-06 16:59:25.958806+00'::timestamp with time zone)) AND ((advertisement_type)::text = 'STANDARD'::text))
  • Rows Removed by Filter: 75
18. 0.030 0.058 ↑ 1.0 35 1

Hash (cost=2.35..2.35 rows=35 width=107) (actual time=0.058..0.058 rows=35 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 13kB
19. 0.028 0.028 ↑ 1.0 35 1

Seq Scan on core_currency (cost=0.00..2.35 rows=35 width=107) (actual time=0.010..0.028 rows=35 loops=1)

20. 0.045 0.068 ↓ 1.4 78 1

Hash (cost=1.55..1.55 rows=55 width=540) (actual time=0.068..0.068 rows=78 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 13kB
21. 0.023 0.023 ↓ 1.4 78 1

Seq Scan on core_publisher (cost=0.00..1.55 rows=55 width=540) (actual time=0.006..0.023 rows=78 loops=1)

22. 1.065 1.065 ↑ 1.0 1 213

Index Scan using core_user_pkey on core_user t9 (cost=0.28..4.32 rows=1 width=467) (actual time=0.004..0.005 rows=1 loops=213)

  • Index Cond: (id = core_offer.advertiser_id)