QUERY PLAN 
 Sort (cost=553657.66..553662.57 rows=1963 width=218) 
  Sort Key: medianame, status 
  InitPlan 
  -> Seq Scan on mediatype (cost=0.00..1.29 rows=1 width=8) 
  Filter: (medianame = 'Audio'::character varying) 
  -> Index Scan using media_mtype_index on media m (cost=0.00..553550.28 rows=1963 width=218) 
  Index Cond: (mediatype = $0) 
  Filter: (subplan) 
  SubPlan 
  -> Limit (cost=138.92..138.93 rows=1 width=24) 
  -> Subquery Scan a1 (cost=138.92..138.93 rows=1 width=24) 
  -> Unique (cost=138.92..138.93 rows=1 width=24) 
  -> Sort (cost=138.92..138.93 rows=2 width=24) 
  Sort Key: mediaid 
  -> Append (cost=0.00..138.91 rows=2 width=24) 
  -> Subquery Scan "*SELECT* 1" (cost=0.00..5.11 rows=1 width=8) 
  -> Index Scan using media_pkey on media (cost=0.00..5.11 rows=1 width=8) 
  Index Cond: (objectid = $1) 
  Filter: (activity = 347667::bigint) 
  -> Subquery Scan "*SELECT* 2" (cost=24.25..133.80 rows=1 width=24) 
  -> Hash Join (cost=24.25..133.80 rows=1 width=24) 
  Hash Cond: ("outer"."set" = "inner".objectid) 
  -> Index Scan using intsetmedia_media_index on intsetmedia ism (cost=0.00..109.26 rows=38 width=16) 
  Index Cond: (media = $1) 
  -> Hash (cost=24.24..24.24 rows=6 width=8) 
  -> Index Scan using set_act_index on "set" s (cost=0.00..24.24 rows=6 width=8) 
  Index Cond: (activity = 347667::bigint) 
