explain.depesz.com

PostgreSQL's explain analyze made readable

Result: K5um

Settings
# exclusive inclusive rows x rows loops node
1. 0.005 27,895.042 ↓ 25.0 25 1

Limit (cost=1,534,452.10..1,534,452.11 rows=1 width=753) (actual time=27,895.034..27,895.042 rows=25 loops=1)

2. 1.753 27,895.037 ↓ 25.0 25 1

Sort (cost=1,534,452.10..1,534,452.11 rows=1 width=753) (actual time=27,895.032..27,895.037 rows=25 loops=1)

  • Sort Key: customwatc0_.title
  • Sort Method: top-N heapsort Memory: 49kB
3. 213.446 27,893.284 ↓ 529.0 529 1

Nested Loop Left Join (cost=0.57..1,534,452.09 rows=1 width=753) (actual time=2.947..27,893.284 rows=529 loops=1)

  • Join Filter: (customwatc0_.query_id = watchquery1_.id)
  • Rows Removed by Join Filter: 2131870
4. 111.872 27,497.862 ↓ 529.0 529 1

Merge Left Join (cost=0.57..1,534,321.39 rows=1 width=616) (actual time=2.372..27,497.862 rows=529 loops=1)

  • Merge Cond: (customwatc0_.cwid = reports2_.cwid)
  • Filter: ((reports2_.report_id IS NULL) OR (reports2_.report_id = (SubPlan 2)))
  • Rows Removed by Filter: 79022
5. 0.995 0.995 ↑ 1.1 529 1

Index Scan using custom_watch_pkey on custom_watch customwatc0_ (cost=0.28..123.19 rows=572 width=96) (actual time=0.012..0.995 rows=529 loops=1)

  • Filter: (entity_id = ANY ('{6,14504,11443,14184,13636,1402,13290,3320,14480,11595,1857,3520,14632,14191,4193,12893,14513,13750,13782,974,4812,13012,14168,856,12678,13006,8797,1322,14009,5776,14766,11172,13279,13626,13625,4013,5959,12548,5878,1441,13863,12169,13627,14607,9877,13052,2612,5852,5953,3617,11164,3906,5927,11171,13637,13641,11381,14395,6312,13301,5559,12209,11597,13640,9347,11296,11197,13781,12045,10942,12596,2500,1750,4037,13164,1657,14059,12995,14544,6,5471,10355,4194,1646,8459,14094,7599,4784,10983,3975,4060,13856,13540,14341,12529,3321,4923,7571}'::integer[]))
  • Rows Removed by Filter: 92
6. 100.374 100.374 ↑ 1.1 83,118 1

Index Scan using idx_watch_report_cwid on watch_report reports2_ (cost=0.29..18,146.17 rows=95,399 width=520) (actual time=0.006..100.374 rows=83,118 loops=1)

7.          

SubPlan (forMerge Left Join)

8. 0.000 27,284.621 ↑ 1.0 1 79,547

Result (cost=19.80..19.81 rows=1 width=4) (actual time=0.343..0.343 rows=1 loops=79,547)

9.          

Initplan (forResult)

10. 79.547 27,284.621 ↑ 1.0 1 79,547

Limit (cost=0.42..19.80 rows=1 width=4) (actual time=0.342..0.343 rows=1 loops=79,547)

11. 27,205.074 27,205.074 ↑ 122.0 1 79,547

Index Scan Backward using idx_report_id_cwid on watch_report customwatc3_ (cost=0.42..2,365.64 rows=122 width=4) (actual time=0.342..0.342 rows=1 loops=79,547)

  • Index Cond: ((report_id IS NOT NULL) AND (cwid = customwatc0_.cwid))
  • Filter: ((report_type)::text = 'CUSTOM'::text)
12. 181.976 181.976 ↑ 1.0 4,031 529

Seq Scan on query watchquery1_ (cost=0.00..80.31 rows=4,031 width=105) (actual time=0.004..0.344 rows=4,031 loops=529)