explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ZRfd

Settings
# exclusive inclusive rows x rows loops node
1. 0.004 6,151.934 ↓ 3.1 25 1

Limit (cost=1,082,759.55..1,082,759.57 rows=8 width=1,149) (actual time=6,151.928..6,151.934 rows=25 loops=1)

2. 0.239 6,151.930 ↓ 3.1 25 1

Sort (cost=1,082,759.55..1,082,759.57 rows=8 width=1,149) (actual time=6,151.926..6,151.930 rows=25 loops=1)

  • Sort Key: e.event_datetime DESC, e.created_on DESC, e.id DESC
  • Sort Method: top-N heapsort Memory: 42kB
3. 695.727 6,151.691 ↓ 11.4 91 1

Nested Loop Left Join (cost=0.99..1,082,759.43 rows=8 width=1,149) (actual time=16.466..6,151.691 rows=91 loops=1)

  • Filter: (((e.customer_id = 17,031,531) AND ((er.event_reference_type_id = 6) OR (er.event_reference_type_id = 9) OR (er.event_reference_type_id = 10) OR (er.event_reference_type_id = 14))) OR (e.lease_id = 14,458,604) OR ((er.reference_id = ANY ('{16387855,16364181,16365358,16386845}'::integer[])) AND (er.event_reference_type_id = 8)))
  • Rows Removed by Filter: 1,050,404
4. 4,406.027 4,406.027 ↓ 1.5 1,049,937 1

Index Scan using idx_events_s1314 on events e (cost=0.56..647,731.27 rows=690,933 width=1,149) (actual time=0.065..4,406.027 rows=1,049,937 loops=1)

  • Index Cond: ((cid = 10,357) AND (property_id = 533,625))
  • Filter: CASE WHEN (event_type_id = 230) THEN (event_sub_type_id = ANY ('{32,33,39,44,37,66,67,38,56,85,125,126,65,64,267,270,288,271,269,268}'::integer[])) ELSE (event_type_id = ANY ('{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,25,28,30,31,32,33,37,38,39,40,43,44,45,46,48,49,52,53,54,55,56,57,58,59,60,61,62,65,67,69,70,71,72,73,77,78,80,82,84,85,86,87,97,98,99,100,101,115,117,119,120,122,230,292}'::integer[])) END
  • Rows Removed by Filter: 334,567
5. 1,049.937 1,049.937 ↓ 0.0 0 1,049,937

Index Scan using idx_event_references_event_id on event_references er (cost=0.43..0.58 rows=1 width=16) (actual time=0.001..0.001 rows=0 loops=1,049,937)

  • Index Cond: (e.id = event_id)
  • Filter: ((cid = 10,357) AND (e.cid = cid))
Planning time : 23.999 ms
Execution time : 6,152.057 ms