explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 1Z8h

Settings
# exclusive inclusive rows x rows loops node
1. 0.062 2,793.435 ↑ 1.0 1,000 1

Limit (cost=97,844.62..97,845.12 rows=1,000 width=8) (actual time=2,793.286..2,793.435 rows=1,000 loops=1)

2. 47.974 2,793.373 ↑ 8.2 1,000 1

Sort (cost=97,844.62..97,848.69 rows=8,156 width=8) (actual time=2,793.285..2,793.373 rows=1,000 loops=1)

  • Sort Key: vw_activity_one_cid.cid
  • Sort Method: top-N heapsort Memory: 127kB
3. 40.139 2,745.399 ↓ 55.1 449,714 1

Subquery Scan on vw_activity_one_cid (cost=97,710.32..97,755.18 rows=8,156 width=8) (actual time=2,502.828..2,745.399 rows=449,714 loops=1)

4. 126.742 2,705.260 ↓ 55.1 449,714 1

Unique (cost=97,710.32..97,730.71 rows=8,156 width=46) (actual time=2,502.826..2,705.260 rows=449,714 loops=1)

5. 303.783 2,578.518 ↓ 55.1 449,714 1

Sort (cost=97,710.32..97,714.40 rows=8,156 width=46) (actual time=2,502.823..2,578.518 rows=449,714 loops=1)

  • Sort Key: activities.id, activities.cid, activities.created_at, pf.channel
  • Sort Method: quicksort Memory: 47422kB
6. 59.890 2,274.735 ↓ 55.1 449,714 1

Nested Loop (cost=4.59..97,604.35 rows=8,156 width=46) (actual time=359.940..2,274.735 rows=449,714 loops=1)

  • Join Filter: (((pf.activity_type)::text = (activity_types."Name")::text) OR ((pf.activity_type)::text = 'ALL'::text))
7. 201.262 1,765.131 ↓ 55.1 449,714 1

Nested Loop (cost=4.56..97,312.89 rows=8,156 width=66) (actual time=359.926..1,765.131 rows=449,714 loops=1)

  • Join Filter: ((activities."activity_Role" = activity_roles.id) AND (((pf.activity_role)::text = (activity_roles."Name")::text) OR ((pf.activity_role)::text = 'ALL'::text)))
  • Rows Removed by Join Filter: 419390
8. 843.445 1,563.869 ↓ 52.2 449,714 1

Hash Join (cost=4.56..97,239.29 rows=8,618 width=86) (actual time=359.906..1,563.869 rows=449,714 loops=1)

  • Hash Cond: (activities."Source" = source_applications.id)
  • Join Filter: (((pf.level)::text = activities.brand_text) OR ((pf.level)::text = 'ALL'::text))
  • Rows Removed by Join Filter: 5396568
9. 720.045 720.045 ↑ 1.5 455,759 1

Index Scan using created_date_ids on activities (cost=0.09..96,577.76 rows=675,835 width=88) (actual time=0.045..720.045 rows=455,759 loops=1)

  • Index Cond: (created_at > '2018-12-05 15:01:37'::timestamp without time zone)
  • Filter: ((cid > 1) AND (status = 't'::text))
  • Rows Removed by Filter: 440526
10. 0.025 0.379 ↓ 63.0 63 1

Hash (cost=4.47..4.47 rows=1 width=41) (actual time=0.379..0.379 rows=63 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 13kB
11. 0.157 0.354 ↓ 63.0 63 1

Nested Loop (cost=0.00..4.47 rows=1 width=41) (actual time=0.054..0.354 rows=63 loops=1)

  • Join Filter: (((pf.source_application)::text = (source_applications."Name")::text) OR ((pf.source_application)::text = 'ALL'::text))
  • Rows Removed by Join Filter: 1134
12. 0.071 0.071 ↓ 63.0 63 1

Seq Scan on permission_firsts pf (cost=0.00..3.35 rows=1 width=37) (actual time=0.041..0.071 rows=63 loops=1)

  • Filter: (btrim((channel)::text) = 'Veeva_CRM'::text)
  • Rows Removed by Filter: 26
13. 0.126 0.126 ↓ 1.1 19 63

Seq Scan on source_applications (cost=0.00..1.05 rows=18 width=48) (actual time=0.001..0.002 rows=19 loops=63)

14. 0.000 0.000 ↑ 1.0 2 449,714

Materialize (cost=0.00..1.01 rows=2 width=48) (actual time=0.000..0.000 rows=2 loops=449,714)

15. 0.007 0.007 ↑ 1.0 2 1

Seq Scan on activity_roles (cost=0.00..1.01 rows=2 width=48) (actual time=0.006..0.007 rows=2 loops=1)

16. 449.714 449.714 ↑ 1.0 1 449,714

Index Scan using index_activity_types_on_id on activity_types (cost=0.03..0.03 rows=1 width=48) (actual time=0.001..0.001 rows=1 loops=449,714)

  • Index Cond: (id = activities."Type")