explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 4549

Settings
# exclusive inclusive rows x rows loops node
1. 382.621 43,388.538 ↓ 5.0 20 1

Limit (cost=29,652,610.29..29,652,610.30 rows=4 width=361) (actual time=43,388.531..43,388.538 rows=20 loops=1)

  • Functions: 22
  • Options: Inlining true, Optimization true, Expressions true, Deforming true
  • Timing: Generation 4.771 ms, Inlining 112.659 ms, Optimization 175.936 ms, Emission 93.598 ms, Total 386.964 ms
2. 0.225 43,005.917 ↓ 5.0 20 1

Sort (cost=29,652,610.29..29,652,610.30 rows=4 width=361) (actual time=43,005.913..43,005.917 rows=20 loops=1)

  • Sort Key: opportunity_procedure.refreshed_at DESC
  • Sort Method: top-N heapsort Memory: 30kB
3. 21,039.098 43,005.692 ↓ 17.5 70 1

Function Scan on opportunity_processed opportunity_procedure (cost=0.25..29,652,610.25 rows=4 width=361) (actual time=5,635.239..43,005.692 rows=70 loops=1)

  • Filter: ((deleted_at IS NULL) AND ((SubPlan 1) OR COALESCE((lower(unaccent(observation)) ~~ lower(unaccent('%eman%'::text))), false) OR ((SubPlan 2) AND (owned_by = 3,600))))
  • Rows Removed by Filter: 50,723
4.          

SubPlan (for Function Scan)

5. 406.344 406.344 ↓ 0.0 0 50,793

Index Scan using person_person_id_uindex on person (cost=0.42..8.46 rows=1 width=0) (actual time=0.008..0.008 rows=0 loops=50,793)

  • Index Cond: (person_id = opportunity_procedure.person_id)
  • Filter: ((deleted_at IS NULL) AND (system_id = 398) AND COALESCE((lower(unaccent(name)) ~~ lower(unaccent('%eman%'::text))), false))
  • Rows Removed by Filter: 1
6. 17,491.750 21,560.250 ↑ 73.2 4,670 50,730

Materialize (cost=0.00..58,433.39 rows=341,946 width=4) (actual time=0.000..0.425 rows=4,670 loops=50,730)

7. 4,068.500 4,068.500 ↑ 72.6 4,710 1

Seq Scan on opportunity_timeline (cost=0.00..55,387.65 rows=341,946 width=4) (actual time=4.222..4,068.500 rows=4,710 loops=1)

  • Filter: ((deleted_at IS NULL) AND (type = 2) AND COALESCE((lower(unaccent((data ->> 'text'::text))) ~~ lower(unaccent('%eman%'::text))), false))
  • Rows Removed by Filter: 1,026,990
Execution time : 43,419.098 ms