Performance testing moodle.org details

Jump to: navigation, search

Note: You are currently viewing documentation for Moodle 2.4. Up-to-date documentation for the latest stable version of Moodle may be available here: Performance testing moodle.org details.

slowtest

with innodb (before cache)


25 slowest queries in moodle.org
.........................
1 iterations of query 0: total time 0.030494928359985 seconds (avg. 0.030494928359985 seconds)
1 iterations of query 1: total time 42.183392047882 seconds (avg. 42.183392047882 seconds)
1 iterations of query 2: total time 1.9312369823456 seconds (avg. 1.9312369823456 seconds)
1 iterations of query 3: total time 51.22772693634 seconds (avg. 51.22772693634 seconds)
1 iterations of query 4: total time 1.1148638725281 seconds (avg. 1.1148638725281 seconds)
1 iterations of query 5: total time 1.6617360115051 seconds (avg. 1.6617360115051 seconds)
1 iterations of query 6: total time 23.254682064056 seconds (avg. 23.254682064056 seconds)
1 iterations of query 7: total time 7.9712381362915 seconds (avg. 7.9712381362915 seconds)
1 iterations of query 8: total time 0.015857934951782 seconds (avg. 0.015857934951782 seconds)
1 iterations of query 9: total time 0.30761003494263 seconds (avg. 0.30761003494263 seconds)
1 iterations of query 10: total time 0.16587519645691 seconds (avg. 0.16587519645691 seconds)
1 iterations of query 11: total time 0.00037288665771484 seconds (avg. 0.00037288665771484 seconds)
1 iterations of query 12: total time 0.25178194046021 seconds (avg. 0.25178194046021 seconds)
1 iterations of query 13: total time 0.00029802322387695 seconds (avg. 0.00029802322387695 seconds)
1 iterations of query 14: total time 0.00024104118347168 seconds (avg. 0.00024104118347168 seconds)
1 iterations of query 15: total time 0.078457117080688 seconds (avg. 0.078457117080688 seconds)
1 iterations of query 16: total time 4.0515379905701 seconds (avg. 4.0515379905701 seconds)
1 iterations of query 17: total time 0.0073158740997314 seconds (avg. 0.0073158740997314 seconds)
1 iterations of query 18: total time 2.0450401306152 seconds (avg. 2.0450401306152 seconds)
1 iterations of query 19: total time 0.027537107467651 seconds (avg. 0.027537107467651 seconds)
1 iterations of query 20: total time 1.1157040596008 seconds (avg. 1.1157040596008 seconds)
1 iterations of query 21: total time 0.078656196594238 seconds (avg. 0.078656196594238 seconds)
1 iterations of query 22: total time 3.5041410923004 seconds (avg. 3.5041410923004 seconds)
1 iterations of query 23: total time 0.73689198493958 seconds (avg. 0.73689198493958 seconds)
1 iterations of query 24: total time 2.2039468288422 seconds (avg. 2.2039468288422 seconds)

TOTAL: 1 iterations of 25 queries: total time  143.9666364193 seconds (avg. 5.7586654567719 seconds)


---------- ---------- ---------- ---------- ---------- ----------
QUERY 0:
DELETE FROM cache_text WHERE timemodified < '1234354127'
---------- ---------- ---------- ---------- ---------- ----------
QUERY 1:
SELECT f.id, COUNT(p.id) AS unread
      FROM forum_posts p
        JOIN forum_discussions d       ON d.id = p.discussion
          JOIN forum f                   ON f.id = d.forum
            JOIN course c                  ON c.id = f.course
              LEFT JOIN forum_read r         ON (r.postid = p.id AND r.userid = 716)
                LEFT JOIN forum_track_prefs tf ON (tf.userid = 716 AND tf.forumid = f.id)
                  WHERE f.course = 11
                    AND p.modified >= 1233273900 AND r.id is NULL
                      AND (f.trackingtype = 2
                        OR (f.trackingtype = 1 AND tf.id IS NULL))
                        GROUP BY f.id
---------- ---------- ---------- ---------- ---------- ----------
QUERY 2:
SELECT p.id, p.subject, p.modified, p.discussion, p.userid, d.name,
      d.timemodified, d.usermodified, d.groupid, (COUNT(p.id) - 1) AS replies
        FROM forum_posts p
          , forum_discussions d 
            WHERE d.course = 11
              AND d.id = p.discussion 
                AND d.userid <> 153 AND p.modified >= '1234138176'
                  GROUP BY p.discussion
                    ORDER BY replies ASC
                      ,p.modified ASC
                        LIMIT 2
---------- ---------- ---------- ---------- ---------- ----------
QUERY 3:
SELECT p.*,
      d.forum,
        u.firstname,
          u.lastname,
            u.email,
              u.picture,
                u.imagealt
                  FROM forum_posts p,
                    forum_discussions d,
                      user u
                        WHERE  (p.modified >= 665341500)
                          AND p.discussion = d.id
                            AND p.userid = u.id
                              AND ((d.forum IN (15,32,931,485,94,1048,117,118,119,587,1001,116,126,337,333,121,122,365,123,366,124,128,396,441,345,678,512,397,320,224,476,130,967,941,1010,323,25,27,125,466,1006,141,140,999,603,1013,1023,1007,120,1022,1028,962,469,1000,1012,132,811,30,1024,1003,352,947,954,29,24,114,480,127,731,33,34,26,28,142,820,1027,827,965,994,998,1002)))
                                ORDER BY p.modified DESC LIMIT 307670,10
---------- ---------- ---------- ---------- ---------- ----------
QUERY 4:
SELECT * FROM (SELECT p.discussion, (COUNT(p.id) - 1) AS replies, MAX(p.id) AS lastpostid
      FROM forum_posts p
        JOIN forum_discussions d ON p.discussion = d.id
          WHERE d.forum = 15
            GROUP BY p.discussion , d.timemodified 
              ORDER BY d.timemodified DESC) sq LIMIT 900,100
---------- ---------- ---------- ---------- ---------- ----------
QUERY 5:
SELECT d.forum,d.course,COUNT(p.id) AS count  FROM forum_posts p  JOIN forum_discussions d ON p.discussion = d.id  LEFT JOIN forum_read r ON r.postid = p.id AND r.userid = 32175 WHERE ((d.forum = 15 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 32 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 931 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 485 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 94 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1048 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 117 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 118 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 119 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 587 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1001 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 116 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 126 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 337 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 333 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 121 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 122 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 365 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 123 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 366 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 124 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 128 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 396 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 441 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 345 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 678 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 512 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 397 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 320 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 224 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 476 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 130 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 967 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 941 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1010 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 323 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 25 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 27 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 125 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 466 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1006 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 141 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 140 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 999 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 603 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1013 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1023 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1007 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 120 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1022 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1028 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 962 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 469 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1000 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1012 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 132 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 811 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 30 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1024 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1003 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 352 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 947 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 954 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 29 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 24 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 114 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 480 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 127 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 731 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 33 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 34 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 26 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 28 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 142 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 820 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1027 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 827 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 965 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 994 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 998 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 934 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 602 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 800 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 302 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 279 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 271 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 270 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 272 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 275 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 596 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 310 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 538 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 276 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 304 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 356 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 535 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 586 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 277 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 278 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 497 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 543 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 590 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 292 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 293 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 630 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 269 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 266 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 340 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 905 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 806 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 170 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 925 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 342 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 959 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1016 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 981 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 896 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 777 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) ) AND p.modified >= 1233274139 AND r.id is NULL GROUP BY d.forum,d.course
---------- ---------- ---------- ---------- ---------- ----------
QUERY 6:
SELECT l.*, u.firstname, u.lastname, u.picture
      FROM log l LEFT JOIN user u ON l.userid = u.id WHERE l.course='5' AND l.userid = '153' ORDER BY l.time DESC LIMIT 1297000,100
---------- ---------- ---------- ---------- ---------- ----------
QUERY 7:
SELECT l.*, u.firstname, u.lastname, u.picture
      FROM log l LEFT JOIN user u ON l.userid = u.id WHERE l.course='5' AND l.userid = '153' ORDER BY l.time DESC LIMIT 1077500,100
---------- ---------- ---------- ---------- ---------- ----------
QUERY 8:
DELETE FROM log WHERE time < '1231347952'
---------- ---------- ---------- ---------- ---------- ----------
QUERY 9:
 SELECT p.id AS postid,
      d.id AS discussionid,
        d.name AS discussionname,
          u.id AS userid,
            u.firstname AS userfirstname,
              u.lastname AS userlastname,
                p.subject AS postsubject,
                  p.message AS postmessage,
                    p.created AS postcreated,
                      p.format AS postformat
                        FROM forum_discussions d,
                          forum_posts p,
                            user u
                              WHERE d.forum = '32' AND
                                p.discussion = d.id AND
                                  u.id = p.userid  AND p.modified > '1234308778'
                                    ORDER BY p.created desc LIMIT 10
---------- ---------- ---------- ---------- ---------- ----------
QUERY 10:
 SELECT instance,cmid,l.course,COUNT(l.id) as count FROM log l  JOIN course_modules cm ON cm.id = cmid  WHERE ((l.course = 5 AND l.time > 1234242461) ) AND l.module = 'forum' AND action LIKE 'add post%'  AND userid != 638275 GROUP BY cmid,l.course,instance
---------- ---------- ---------- ---------- ---------- ----------
QUERY 11:
SELECT * FROM cache_text WHERE md5key = 'f6dc0402d19753e135960ec40dfa7128' LIMIT 1
---------- ---------- ---------- ---------- ---------- ----------
QUERY 12:
SELECT * FROM message_read WHERE (useridto = '128371' AND useridfrom = '114402') OR
      (useridto = '114402' AND useridfrom = '128371') ORDER BY timecreated
---------- ---------- ---------- ---------- ---------- ----------
QUERY 13:
SELECT COUNT(*)
      FROM forum_posts p,
        forum_discussions d,
          user u
            WHERE  MATCH (p.message, p.subject) AGAINST ('+no* +permite* +que* +entre* +nadie*' IN BOOLEAN MODE)
              AND p.discussion = d.id
                AND p.userid = u.id
                  AND ((d.forum IN (100,103,102,513,625,883,955,988,714,104,106,107,108,109,110,111,112,351,338)))
---------- ---------- ---------- ---------- ---------- ----------
QUERY 14:
SELECT p.*,
      d.forum,
        u.firstname,
          u.lastname,
            u.email,
              u.picture,
                u.imagealt
                  FROM forum_posts p,  forum_discussions d,
                    user u
                      WHERE  MATCH (p.message, p.subject) AGAINST ('+tex*' IN BOOLEAN MODE)
                        AND p.discussion = d.id
                          AND p.userid = u.id
                            AND ((d.forum IN (15,32,931,485,94,1048,117,118,119,587,1001,116,126,337,333,121,122,365,123,366,124,128,396,441,345,678,512,397,320,224,476,130,967,941,1010,323,25,27,125,466,1006,141,140,999,603,1013,1023,1007,120,102
                            2,1028,962,469,1000,1012,132,811,30,1024,1003,352,947,954,29,24,114,480,127,731,33,34,26,28,142,820,1027,827,965,994,998,1002)))
                            ORDER BY p.modified DESC LIMIT 21990,10
---------- ---------- ---------- ---------- ---------- ----------
QUERY 15:
SELECT instance,cmid,l.course,COUNT(l.id) as count FROM log l  JOIN course_modules cm ON cm.id = cmid  WHERE ((l.course = 5 AND l.time > 1234335323) OR (l.course = 55 AND l.time > 1234102485) OR (l.course = 33 AND l.time > 1234102459) OR (l.course = 32 AND l.time > 1234266018) OR (l.course = 31 AND l.time > 1234102468) OR (l.course = 48 AND l.time > 1234347206) OR (l.course = 18 AND l.time > 1234301428) ) AND l.module = 'forum' AND action LIKE 'add post%'  AND userid != 5382 GROUP BY cmid,l.course,instance
---------- ---------- ---------- ---------- ---------- ----------
QUERY 16:
SELECT * FROM log WHERE userid='153' AND module='resource'
      AND action='view' AND info='273' ORDER BY time ASC
---------- ---------- ---------- ---------- ---------- ----------
QUERY 17:
INSERT INTO log (time, userid, course, ip, module, cmid, action, url, info)
      VALUES ('1234467474', '153', '1', '190.128.3.65', 'user', '0', 'login', 'view.php?id=0&course=1', '153')
---------- ---------- ---------- ---------- ---------- ----------
QUERY 18:
SELECT COUNT(*) FROM user WHERE firstaccess > 1234224195
---------- ---------- ---------- ---------- ---------- ----------
QUERY 19:
SELECT l.*, cm.instance FROM log l 
      INNER JOIN course_modules cm ON l.cmid = cm.id 
        WHERE l.time > '1234199200' AND l.course = 11 
          AND l.module = 'wiki' AND action LIKE 'edit%'
            ORDER BY l.time ASC
---------- ---------- ---------- ---------- ---------- ----------
QUERY 20:
DELETE
      FROM forum_read
        WHERE postid IN (SELECT fp.id
          FROM forum_posts fp
            WHERE fp.modified >= 1233011222 AND fp.modified < 1233099102)
---------- ---------- ---------- ---------- ---------- ----------
QUERY 21:
SELECT * FROM event WHERE (timestart >= 1234386000 OR timestart + timeduration > 1234386000) AND timestart <= 1249937999 AND ( (userid = 794412 AND courseid = 0 AND groupid = 0) OR (groupid = 0 AND courseid IN (1))) AND visible = 1 ORDER BY timestart
---------- ---------- ---------- ---------- ---------- ----------
QUERY 22:
SELECT floor((time - 1231340400)/86400) as day, count(*) as num
      FROM log
        WHERE userid = '153'
          AND time > '1231340400'  AND course = '5' 
            GROUP BY floor((time - 1231340400)/86400)
---------- ---------- ---------- ---------- ---------- ----------
QUERY 23:
 SELECT u.id, u.username, u.firstname, u.lastname, u.picture, max(ul.timeaccess) as lastaccess FROM user_lastaccess ul,
      user u
        , role_assignments ra WHERE ul.timeaccess > 1234409700
          AND u.id = ul.userid
            AND ul.courseid = 5
              AND ra.userid = u.id AND ra.contextid  IN (53,54,50) AND ra.hidden = 0 GROUP BY u.id, u.username, u.firstname, u.lastname, u.picture ORDER BY lastaccess DESC  LIMIT 50
---------- ---------- ---------- ---------- ---------- ----------
QUERY 24:
SELECT DISTINCT u.id, u.username, u.firstname, u.lastname,
      u.email, u.city, u.country, u.picture,
        u.lang, u.timezone, u.emailstop, u.maildisplay, u.imagealt,
          COALESCE(ul.timeaccess, 0) AS lastaccess,
            r.hidden,
              ctx.id AS ctxid, ctx.path AS ctxpath,
                ctx.depth AS ctxdepth, ctx.contextlevel AS ctxlevel FROM user u
                  LEFT OUTER JOIN context ctx
                    ON (u.id=ctx.instanceid AND ctx.contextlevel = 30)
                      JOIN role_assignments r
                        ON u.id=r.userid
                          LEFT OUTER JOIN user_lastaccess ul
                            ON (r.userid=ul.userid and ul.courseid = 11) WHERE (r.contextid = 74 OR r.contextid in (63,50))
                              AND u.deleted = 0  
                                AND (ul.courseid = 11 OR ul.courseid IS NULL)
                                  AND u.username != 'guest'
                                    AND r.roleid NOT IN (1,8,9)
                                      AND r.hidden = 0   ORDER BY lastaccess DESC, r.hidden DESC LIMIT 20


with innodb (after cache)

25 slowest queries in moodle.org
.........................
1 iterations of query 0: total time 0.0002140998840332 seconds (avg. 0.0002140998840332 seconds)
1 iterations of query 1: total time 0.00020885467529297 seconds (avg. 0.00020885467529297 seconds)
1 iterations of query 2: total time 0.00022602081298828 seconds (avg. 0.00022602081298828 seconds)
1 iterations of query 3: total time 12.0990421772 seconds (avg. 12.0990421772 seconds)
1 iterations of query 4: total time 0.00035285949707031 seconds (avg. 0.00035285949707031 seconds)
1 iterations of query 5: total time 0.00070786476135254 seconds (avg. 0.00070786476135254 seconds)
1 iterations of query 6: total time 8.8177051544189 seconds (avg. 8.8177051544189 seconds)
1 iterations of query 7: total time 7.9543449878693 seconds (avg. 7.9543449878693 seconds)
1 iterations of query 8: total time 0.00032997131347656 seconds (avg. 0.00032997131347656 seconds)
1 iterations of query 9: total time 0.31666994094849 seconds (avg. 0.31666994094849 seconds)
1 iterations of query 10: total time 0.026017904281616 seconds (avg. 0.026017904281616 seconds)
1 iterations of query 11: total time 0.0002140998840332 seconds (avg. 0.0002140998840332 seconds)
1 iterations of query 12: total time 0.00054311752319336 seconds (avg. 0.00054311752319336 seconds)
1 iterations of query 13: total time 0.00034093856811523 seconds (avg. 0.00034093856811523 seconds)
1 iterations of query 14: total time 0.000244140625 seconds (avg. 0.000244140625 seconds)
1 iterations of query 15: total time 0.028167009353638 seconds (avg. 0.028167009353638 seconds)
1 iterations of query 16: total time 3.1385700702667 seconds (avg. 3.1385700702667 seconds)
1 iterations of query 17: total time 0.00049185752868652 seconds (avg. 0.00049185752868652 seconds)
1 iterations of query 18: total time 1.0714440345764 seconds (avg. 1.0714440345764 seconds)
1 iterations of query 19: total time 0.0014829635620117 seconds (avg. 0.0014829635620117 seconds)
1 iterations of query 20: total time 0.96108388900757 seconds (avg. 0.96108388900757 seconds)
1 iterations of query 21: total time 0.00029587745666504 seconds (avg. 0.00029587745666504 seconds)
1 iterations of query 22: total time 3.5078561306 seconds (avg. 3.5078561306 seconds)
1 iterations of query 23: total time 0.04079008102417 seconds (avg. 0.04079008102417 seconds)
1 iterations of query 24: total time 0.058726072311401 seconds (avg. 0.058726072311401 seconds)

TOTAL: 1 iterations of 25 queries: total time  38.02607011795 seconds (avg. 1.521042804718 seconds)


---------- ---------- ---------- ---------- ---------- ----------
QUERY 0:
DELETE FROM cache_text WHERE timemodified < '1234354127'
---------- ---------- ---------- ---------- ---------- ----------
QUERY 1:
SELECT f.id, COUNT(p.id) AS unread
      FROM forum_posts p
        JOIN forum_discussions d       ON d.id = p.discussion
          JOIN forum f                   ON f.id = d.forum
            JOIN course c                  ON c.id = f.course
              LEFT JOIN forum_read r         ON (r.postid = p.id AND r.userid = 716)
                LEFT JOIN forum_track_prefs tf ON (tf.userid = 716 AND tf.forumid = f.id)
                  WHERE f.course = 11
                    AND p.modified >= 1233273900 AND r.id is NULL
                      AND (f.trackingtype = 2
                        OR (f.trackingtype = 1 AND tf.id IS NULL))
                        GROUP BY f.id
---------- ---------- ---------- ---------- ---------- ----------
QUERY 2:
SELECT p.id, p.subject, p.modified, p.discussion, p.userid, d.name,
      d.timemodified, d.usermodified, d.groupid, (COUNT(p.id) - 1) AS replies
        FROM forum_posts p
          , forum_discussions d 
            WHERE d.course = 11
              AND d.id = p.discussion 
                AND d.userid <> 153 AND p.modified >= '1234138176'
                  GROUP BY p.discussion
                    ORDER BY replies ASC
                      ,p.modified ASC
                        LIMIT 2
---------- ---------- ---------- ---------- ---------- ----------
QUERY 3:
SELECT p.*,
      d.forum,
        u.firstname,
          u.lastname,
            u.email,
              u.picture,
                u.imagealt
                  FROM forum_posts p,
                    forum_discussions d,
                      user u
                        WHERE  (p.modified >= 665341500)
                          AND p.discussion = d.id
                            AND p.userid = u.id
                              AND ((d.forum IN (15,32,931,485,94,1048,117,118,119,587,1001,116,126,337,333,121,122,365,123,366,124,128,396,441,345,678,512,397,320,224,476,130,967,941,1010,323,25,27,125,466,1006,141,140,999,603,1013,1023,1007,120,1022,1028,962,469,1000,1012,132,811,30,1024,1003,352,947,954,29,24,114,480,127,731,33,34,26,28,142,820,1027,827,965,994,998,1002)))
                                ORDER BY p.modified DESC LIMIT 307670,10
---------- ---------- ---------- ---------- ---------- ----------
QUERY 4:
SELECT * FROM (SELECT p.discussion, (COUNT(p.id) - 1) AS replies, MAX(p.id) AS lastpostid
      FROM forum_posts p
        JOIN forum_discussions d ON p.discussion = d.id
          WHERE d.forum = 15
            GROUP BY p.discussion , d.timemodified 
              ORDER BY d.timemodified DESC) sq LIMIT 900,100
---------- ---------- ---------- ---------- ---------- ----------
QUERY 5:
SELECT d.forum,d.course,COUNT(p.id) AS count  FROM forum_posts p  JOIN forum_discussions d ON p.discussion = d.id  LEFT JOIN forum_read r ON r.postid = p.id AND r.userid = 32175 WHERE ((d.forum = 15 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 32 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 931 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 485 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 94 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1048 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 117 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 118 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 119 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 587 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1001 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 116 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 126 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 337 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 333 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 121 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 122 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 365 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 123 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 366 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 124 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 128 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 396 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 441 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 345 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 678 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 512 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 397 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 320 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 224 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 476 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 130 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 967 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 941 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1010 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 323 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 25 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 27 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 125 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 466 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1006 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 141 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 140 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 999 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 603 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1013 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1023 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1007 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 120 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1022 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1028 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 962 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 469 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1000 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1012 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 132 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 811 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 30 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1024 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1003 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 352 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 947 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 954 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 29 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 24 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 114 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 480 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 127 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 731 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 33 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 34 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 26 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 28 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 142 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 820 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1027 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 827 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 965 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 994 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 998 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 934 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 602 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 800 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 302 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 279 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 271 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 270 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 272 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 275 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 596 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 310 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 538 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 276 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 304 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 356 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 535 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 586 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 277 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 278 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 497 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 543 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 590 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 292 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 293 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 630 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 269 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 266 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 340 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 905 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 806 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 170 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 925 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 342 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 959 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 1016 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 981 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 896 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) OR (d.forum = 777 AND (d.groupid = -1 OR d.groupid = 0 OR d.groupid = 0)) ) AND p.modified >= 1233274139 AND r.id is NULL GROUP BY d.forum,d.course
---------- ---------- ---------- ---------- ---------- ----------
QUERY 6:
SELECT l.*, u.firstname, u.lastname, u.picture
      FROM log l LEFT JOIN user u ON l.userid = u.id WHERE l.course='5' AND l.userid = '153' ORDER BY l.time DESC LIMIT 1297000,100
---------- ---------- ---------- ---------- ---------- ----------
QUERY 7:
SELECT l.*, u.firstname, u.lastname, u.picture
      FROM log l LEFT JOIN user u ON l.userid = u.id WHERE l.course='5' AND l.userid = '153' ORDER BY l.time DESC LIMIT 1077500,100
---------- ---------- ---------- ---------- ---------- ----------
QUERY 8:
DELETE FROM log WHERE time < '1231347952'
---------- ---------- ---------- ---------- ---------- ----------
QUERY 9:
 SELECT p.id AS postid,
      d.id AS discussionid,
        d.name AS discussionname,
          u.id AS userid,
            u.firstname AS userfirstname,
              u.lastname AS userlastname,
                p.subject AS postsubject,
                  p.message AS postmessage,
                    p.created AS postcreated,
                      p.format AS postformat
                        FROM forum_discussions d,
                          forum_posts p,
                            user u
                              WHERE d.forum = '32' AND
                                p.discussion = d.id AND
                                  u.id = p.userid  AND p.modified > '1234308778'
                                    ORDER BY p.created desc LIMIT 10
---------- ---------- ---------- ---------- ---------- ----------
QUERY 10:
 SELECT instance,cmid,l.course,COUNT(l.id) as count FROM log l  JOIN course_modules cm ON cm.id = cmid  WHERE ((l.course = 5 AND l.time > 1234242461) ) AND l.module = 'forum' AND action LIKE 'add post%'  AND userid != 638275 GROUP BY cmid,l.course,instance
---------- ---------- ---------- ---------- ---------- ----------
QUERY 11:
SELECT * FROM cache_text WHERE md5key = 'f6dc0402d19753e135960ec40dfa7128' LIMIT 1
---------- ---------- ---------- ---------- ---------- ----------
QUERY 12:
SELECT * FROM message_read WHERE (useridto = '128371' AND useridfrom = '114402') OR
      (useridto = '114402' AND useridfrom = '128371') ORDER BY timecreated
---------- ---------- ---------- ---------- ---------- ----------
QUERY 13:
SELECT COUNT(*)
      FROM forum_posts p,
        forum_discussions d,
          user u
            WHERE  MATCH (p.message, p.subject) AGAINST ('+no* +permite* +que* +entre* +nadie*' IN BOOLEAN MODE)
              AND p.discussion = d.id
                AND p.userid = u.id
                  AND ((d.forum IN (100,103,102,513,625,883,955,988,714,104,106,107,108,109,110,111,112,351,338)))
---------- ---------- ---------- ---------- ---------- ----------
QUERY 14:
SELECT p.*,
      d.forum,
        u.firstname,
          u.lastname,
            u.email,
              u.picture,
                u.imagealt
                  FROM forum_posts p,  forum_discussions d,
                    user u
                      WHERE  MATCH (p.message, p.subject) AGAINST ('+tex*' IN BOOLEAN MODE)
                        AND p.discussion = d.id
                          AND p.userid = u.id
                            AND ((d.forum IN (15,32,931,485,94,1048,117,118,119,587,1001,116,126,337,333,121,122,365,123,366,124,128,396,441,345,678,512,397,320,224,476,130,967,941,1010,323,25,27,125,466,1006,141,140,999,603,1013,1023,1007,120,102
                            2,1028,962,469,1000,1012,132,811,30,1024,1003,352,947,954,29,24,114,480,127,731,33,34,26,28,142,820,1027,827,965,994,998,1002)))
                            ORDER BY p.modified DESC LIMIT 21990,10
---------- ---------- ---------- ---------- ---------- ----------
QUERY 15:
SELECT instance,cmid,l.course,COUNT(l.id) as count FROM log l  JOIN course_modules cm ON cm.id = cmid  WHERE ((l.course = 5 AND l.time > 1234335323) OR (l.course = 55 AND l.time > 1234102485) OR (l.course = 33 AND l.time > 1234102459) OR (l.course = 32 AND l.time > 1234266018) OR (l.course = 31 AND l.time > 1234102468) OR (l.course = 48 AND l.time > 1234347206) OR (l.course = 18 AND l.time > 1234301428) ) AND l.module = 'forum' AND action LIKE 'add post%'  AND userid != 5382 GROUP BY cmid,l.course,instance
---------- ---------- ---------- ---------- ---------- ----------
QUERY 16:
SELECT * FROM log WHERE userid='153' AND module='resource'
      AND action='view' AND info='273' ORDER BY time ASC
---------- ---------- ---------- ---------- ---------- ----------
QUERY 17:
INSERT INTO log (time, userid, course, ip, module, cmid, action, url, info)
      VALUES ('1234467474', '153', '1', '190.128.3.65', 'user', '0', 'login', 'view.php?id=0&course=1', '153')
---------- ---------- ---------- ---------- ---------- ----------
QUERY 18:
SELECT COUNT(*) FROM user WHERE firstaccess > 1234224195
---------- ---------- ---------- ---------- ---------- ----------
QUERY 19:
SELECT l.*, cm.instance FROM log l 
      INNER JOIN course_modules cm ON l.cmid = cm.id 
        WHERE l.time > '1234199200' AND l.course = 11 
          AND l.module = 'wiki' AND action LIKE 'edit%'
            ORDER BY l.time ASC
---------- ---------- ---------- ---------- ---------- ----------
QUERY 20:
DELETE
      FROM forum_read
        WHERE postid IN (SELECT fp.id
          FROM forum_posts fp
            WHERE fp.modified >= 1233011222 AND fp.modified < 1233099102)
---------- ---------- ---------- ---------- ---------- ----------
QUERY 21:
SELECT * FROM event WHERE (timestart >= 1234386000 OR timestart + timeduration > 1234386000) AND timestart <= 1249937999 AND ( (userid = 794412 AND courseid = 0 AND groupid = 0) OR (groupid = 0 AND courseid IN (1))) AND visible = 1 ORDER BY timestart
---------- ---------- ---------- ---------- ---------- ----------
QUERY 22:
SELECT floor((time - 1231340400)/86400) as day, count(*) as num
      FROM log
        WHERE userid = '153'
          AND time > '1231340400'  AND course = '5' 
            GROUP BY floor((time - 1231340400)/86400)
---------- ---------- ---------- ---------- ---------- ----------
QUERY 23:
 SELECT u.id, u.username, u.firstname, u.lastname, u.picture, max(ul.timeaccess) as lastaccess FROM user_lastaccess ul,
      user u
        , role_assignments ra WHERE ul.timeaccess > 1234409700
          AND u.id = ul.userid
            AND ul.courseid = 5
              AND ra.userid = u.id AND ra.contextid  IN (53,54,50) AND ra.hidden = 0 GROUP BY u.id, u.username, u.firstname, u.lastname, u.picture ORDER BY lastaccess DESC  LIMIT 50
---------- ---------- ---------- ---------- ---------- ----------
QUERY 24:
SELECT DISTINCT u.id, u.username, u.firstname, u.lastname,
      u.email, u.city, u.country, u.picture,
        u.lang, u.timezone, u.emailstop, u.maildisplay, u.imagealt,
          COALESCE(ul.timeaccess, 0) AS lastaccess,
            r.hidden,
              ctx.id AS ctxid, ctx.path AS ctxpath,
                ctx.depth AS ctxdepth, ctx.contextlevel AS ctxlevel FROM user u
                  LEFT OUTER JOIN context ctx
                    ON (u.id=ctx.instanceid AND ctx.contextlevel = 30)
                      JOIN role_assignments r
                        ON u.id=r.userid
                          LEFT OUTER JOIN user_lastaccess ul
                            ON (r.userid=ul.userid and ul.courseid = 11) WHERE (r.contextid = 74 OR r.contextid in (63,50))
                              AND u.deleted = 0  
                                AND (ul.courseid = 11 OR ul.courseid IS NULL)
                                  AND u.username != 'guest'
                                    AND r.roleid NOT IN (1,8,9)
                                      AND r.hidden = 0   ORDER BY lastaccess DESC, r.hidden DESC LIMIT 20