explain.depesz.com

PostgreSQL's explain analyze made readable

Result: L2jK

Settings
# exclusive inclusive rows x rows loops node
1. 0.003 28,081.051 ↓ 25.0 25 1

Limit (cost=1,343,398.31..1,343,398.32 rows=1 width=753) (actual time=28,081.043..28,081.051 rows=25 loops=1)

2. 1.873 28,081.048 ↓ 25.0 25 1

Sort (cost=1,343,398.31..1,343,398.32 rows=1 width=753) (actual time=28,081.042..28,081.048 rows=25 loops=1)

  • Sort Key: customwatc0_.title
  • Sort Method: top-N heapsort Memory: 49kB
3. 225.446 28,079.175 ↓ 529.0 529 1

Nested Loop Left Join (cost=0.57..1,343,398.30 rows=1 width=753) (actual time=3.492..28,079.175 rows=529 loops=1)

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

Merge Left Join (cost=0.57..1,343,267.60 rows=1 width=616) (actual time=2.918..27,656.412 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. 1.064 1.064 ↑ 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.011..1.064 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. 115.383 115.383 ↑ 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.005..115.383 rows=83,118 loops=1)

7.          

SubPlan (forMerge Left Join)

8. 79.547 27,443.715 ↑ 1.0 1 79,547

Result (cost=17.31..17.32 rows=1 width=4) (actual time=0.345..0.345 rows=1 loops=79,547)

9.          

Initplan (forResult)

10. 0.000 27,364.168 ↑ 1.0 1 79,547

Limit (cost=0.42..17.31 rows=1 width=4) (actual time=0.344..0.344 rows=1 loops=79,547)

11. 27,364.168 27,364.168 ↑ 140.0 1 79,547

Index Only Scan Backward using idx_report_id_cwid on watch_report customwatc3_ (cost=0.42..2,365.29 rows=140 width=4) (actual time=0.344..0.344 rows=1 loops=79,547)

  • Index Cond: ((report_id IS NOT NULL) AND (cwid = customwatc0_.cwid))
  • Heap Fetches: 79547
12. 197.317 197.317 ↑ 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.373 rows=4,031 loops=529)