explain.depesz.com

PostgreSQL's explain analyze made readable

Result: rxFM

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 1,207.799 ↓ 1.5 249 1

Finalize GroupAggregate (cost=1,001.45..382,757.59 rows=168 width=72) (actual time=38.266..1,207.799 rows=249 loops=1)

  • Group Key: sms_campaigns.id
2. 353.892 1,208.476 ↑ 1.3 249 1

Gather Merge (cost=1,001.45..382,754.23 rows=336 width=40) (actual time=15.560..1,208.476 rows=249 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
3. 0.931 854.584 ↑ 2.0 83 3 / 3

Partial GroupAggregate (cost=1.42..381,715.42 rows=168 width=40) (actual time=10.883..854.584 rows=83 loops=3)

  • Group Key: sms_campaigns.id
4. 75.968 853.653 ↑ 6.8 876 3 / 3

Nested Loop (cost=1.42..381,683.89 rows=5,970 width=36) (actual time=8.789..853.653 rows=876 loops=3)

  • Join Filter: ((activities.created_at > sms_campaigns.created_at) AND (activities.created_at < (sms_campaigns.created_at + '30 days'::interval)))
  • Rows Removed by Join Filter: 1738
5. 31.919 124.817 ↑ 1.2 59,352 3 / 3

Nested Loop (cost=0.86..95,294.37 rows=70,166 width=36) (actual time=7.900..124.817 rows=59,352 loops=3)

6. 9.686 9.686 ↓ 1.4 95 3 / 3

Parallel Index Scan using sms_campaigns_pkey on sms_campaigns (cost=0.29..7,976.09 rows=70 width=32) (actual time=7.874..9.686 rows=95 loops=3)

  • Filter: ((created_at >= '2019-11-30 16:00:00'::timestamp without time zone) AND (created_at <= '2020-01-08 15:59:59.999999'::timestamp without time zone) AND (company_id = ANY ('{290,268,221,269,3078,222,270,307,249,3686,250,306,3330,291,271,223,251,242,2839,252,272,226,273,274,224,3329,254,292,293,227,455,275,228,229,255,276,191,230,294,231,277,278,295,296,279,232,256,280,281,257,233,258,2459,282,297,283,298,234,284,4248,259,285,260,261,286,2801,299,305,300,235,154,145,196,287,4505,288,289,379,301,236,2147,308,262,263,237,3562,238,239,2998}'::integer[])))
  • Rows Removed by Filter: 27076
7. 83.212 83.212 ↑ 3.3 627 284 / 3

Index Scan using fk__requests_sms_campaign_id on requests (cost=0.57..1,226.58 rows=2,082 width=8) (actual time=0.012..0.879 rows=627 loops=284)

  • Index Cond: (sms_campaign_id = sms_campaigns.id)
  • Filter: (deleted_at IS NULL)
  • Rows Removed by Filter: 6
8. 652.868 652.868 ↓ 0.0 0 178,055 / 3

Index Scan using index_activities_on_person_id on activities (cost=0.56..4.06 rows=1 width=16) (actual time=0.011..0.011 rows=0 loops=178,055)

  • Index Cond: (person_id = requests.person_id)
  • Filter: ((deleted_at IS NULL) AND ((outcome)::text = 'sale'::text))
  • Rows Removed by Filter: 6
Planning time : 2.152 ms
Execution time : 1,209.240 ms