Forum OpenACS Development: Re: slow notifications query on openacs.org

Collapse
Posted by Dave Bauer on
Here is the plan on cvs.openacs.org

                                                                     QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------------------
 Sort  (cost=1179.86..1180.00 rows=55 width=1303)
   Sort Key: notification_requests.user_id, notifications.type_id, notifications.notif_date
   ->  Nested Loop Left Join  (cost=26.19..1178.27 rows=55 width=1303)
         Filter: ("inner".sent_date IS NULL)
         ->  Nested Loop  (cost=26.19..893.79 rows=55 width=1303)
               Join Filter: ("inner".creation_date <= "outer".notif_date)
               ->  Merge Join  (cost=26.19..60.67 rows=165 width=1307)
                     Merge Cond: (("outer".type_id = "inner".type_id) AND ("outer".object_id = "inner".object_id))
                     ->  Index Scan using notification_requests_type_obj_ on notification_requests  (cost=0.00..682.72 rows=14167 width=20)
                           Filter: (interval_id = 2889)
                     ->  Sort  (cost=26.19..26.48 rows=117 width=1299)
                           Sort Key: notifications.type_id, notifications.object_id
                           ->  Seq Scan on notifications  (cost=0.00..22.17 rows=117 width=1299)
               ->  Index Scan using acs_objects_pk on acs_objects  (cost=0.00..5.03 rows=1 width=12)
                     Index Cond: ("outer".request_id = acs_objects.object_id)
         ->  Index Scan using notification_user_map_n_u_idx on notification_user_map  (cost=0.00..5.16 rows=1 width=16)
               Index Cond: (("outer".notification_id = notification_user_map.notification_id) AND ("outer".user_id = notification_user_map.user_id))