[horde] alarms.php generating tons of sql select

LALOT Dominique dom.lalot at gmail.com
Wed Jan 21 15:42:39 UTC 2009


Hello,

I had a problem trying to get alarms.php working (I solved it now,
notification is a now a pref  in nag and kronolith..)

So I tried to execute manualy the script and looking at mysql.log

38680 lines in mysql.log
6462 SELECT

It looks like that:
         4342 Query       SELECT * FROM kronolith_shares ORDER BY share_name ASC
         4342 Init DB     horde
         4342 Query       SELECT share_id, user_uid, perm FROM
kronolith_shares_users
         4342 Init DB     horde
         4342 Query       SELECT share_id, group_uid, perm FROM
kronolith_shares_groups
         4341 Init DB     horde
Then for each user found..
         4341 Query       SELECT event_id, event_uid,
event_description, event_location, event_private, event_status,
event_attendees, event_keywords, event_title, event_category,
event_recurcount, event_recurtype, event_recurenddate,
event_recurinterval, event_recurdays, event_start, event_end,
event_alarm, event_modified, event_exceptions, event_creator_id FROM
kronolith_events WHERE calendar_id = 'xxx' AND ((event_alarm > 0)) AND
((event_end > '2009-01-21 00:00:00' AND event_start < '9999-12-31
00:00:00') OR (event_recurenddate >= '2009-01-21 00:00:00' AND
event_start <= '9999-12-31 00:00:00' AND event_recurtype <> 0))

Then for nag etc..

That's not very optimized from an sql point of view. That's may be due
to an abstraction layer above sql backend, but being not optimized and
running every 5 minutes can be a problem on large installations

Listusers, then foreach test condition can be done quickly in sql or
ldap as we can get all data in one call.

testDom:/var/www/perso/horde/docs# time /usr/bin/php
/var/www/perso/horde/scripts/alarms.php

real    0m8.690s
user    0m5.870s
sys     0m0.570s

I purge data and it has been drop to 2sec, but in my student
configuration that will be long. To run also reminder.php, I had to go
over 1024Mo memory limit to get it running

Dom

-- 
Dominique LALOT
Ingénieur Systèmes et Réseaux
http://annuaire.univmed.fr/showuser?uid=lalot


More information about the horde mailing list