Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Slow queries on 1.4.3  (Read 2961 times)

0 Members and 1 Guest are viewing this topic.

jp-photo.dk

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 36
    • JP-photo.dk
Slow queries on 1.4.3
« on: October 26, 2006, 10:23:15 am »

I'm experiencing very slow load-times for my pages in the gallery (http://galleri.jp-photo.dk) [edit GauGau] Warning: Link not worksafe! [/edit]. The mainpage loads in about 24 seconds - that is the time to generate the page, so the problem should not be located with the bandwidth etc.

Could it be a missing index on some of the tables? I'll try to look into this myself when I get home..

I've attached the debug-info, and it's obvious where the time is spent..

USER:
------------------
Array
(
    [ID] => 39a1c28a1fc0e74576361c603e02e02c
    [am] => 1
    [liv] => Array
        (
           
  • => 10327
  • [1] => 8982
                [2] => 10711
                [3] => 7580
                [4] => 10716
            )

    )

    ==========================
    USER DATA:
    ------------------
    Array
    (
       
[user_id] => 1
    [user_name] => admin
    [groups] => Array
        (
           
  • => 1

        )

    [disk_max] => 0
    [disk_min] => 0
    [can_rate_pictures] => 1
    [can_send_ecards] => 1
    [ufc_max] => 3
    [ufc_min] => 3
    [custom_user_upload] => 0
    [num_file_upload] => 5
    [num_URI_upload] => 3
    [can_post_comments] => 1
    [can_upload_pictures] => 1
    [can_create_albums] => 1
    [has_admin_access] => 1
    [pub_upl_need_approval] => 0
    [priv_upl_need_approval] => 0
    [group_name] => Administrators
    [upload_form_config] => 3
    [group_quota] => 0
    [can_see_all_albums] => 1
    [group_id] => 1
)

==========================
Queries:
------------------
Array
(
   
  • => SELECT extension, mime, content, player FROM cpg11d_filetypes; (0.004s)
  • [1] => select * from cpg11d_plugins order by priority asc; (0.002s)
        [2] => delete from `coppermine`.cpg11d_sessions where time<1161847198 and remember=0; (0.003s)
        [3] => delete from `coppermine`.cpg11d_sessions where time<1160641198; (0.003s)
        [4] => select user_id from `coppermine`.cpg11d_sessions where session_id=md5("52f628362f69137b131666a18b8ba860f433ce41efac8bca12ef19dde25b0839"); (0.002s)
        [5] => select user_id as id, user_password as password from `coppermine`.cpg11d_users where user_id=1 (0.002s)
        [6] => SELECT u.user_id AS id, u.user_name AS username, u.user_password AS password, u.user_group+100 AS group_id FROM `coppermine`.cpg11d_users AS u INNER JOIN `coppermine`.cpg11d_usergroups AS g ON u.user_group=g.group_id WHERE u.user_id='1' (0.003s)
        [7] => SELECT user_group_list FROM `coppermine`.cpg11d_users AS u WHERE user_id='1' and user_group_list <> ''; (0.002s)
        [8] => SELECT MAX(group_quota) as disk_max, MIN(group_quota) as disk_min, MAX(can_rate_pictures) as can_rate_pictures, MAX(can_send_ecards) as can_send_ecards, MAX(upload_form_config) as ufc_max, MIN(upload_form_config) as ufc_min, MAX(custom_user_upload) as custom_user_upload, MAX(num_file_upload) as num_file_upload, MAX(num_URI_upload) as num_URI_upload, MAX(can_post_comments) as can_post_comments, MAX(can_upload_pictures) as can_upload_pictures, MAX(can_create_albums) as can_create_albums, MAX(has_admin_access) as has_admin_access, MIN(pub_upl_need_approval) as pub_upl_need_approval, MIN( priv_upl_need_approval) as  priv_upl_need_approval FROM cpg11d_usergroups WHERE group_id in (1) (0.004s)
        [9] => SELECT group_name FROM  cpg11d_usergroups WHERE group_id= 1 (0.002s)
        [10] => update `coppermine`.cpg11d_sessions set time='1161850798' where session_id=md5('52f628362f69137b131666a18b8ba860f433ce41efac8bca12ef19dde25b0839'); (0.002s)
        [11] => SELECT user_favpics FROM cpg11d_favpics WHERE user_id = 1 (0.003s)
        [12] => DELETE FROM cpg11d_banned WHERE expiry < '2006-10-26 08:19:59' (0.002s)
        [13] => SELECT * FROM cpg11d_banned WHERE (ip_addr='131.165.63.132' OR ip_addr='131.165.63.132' OR user_id=1) AND brute_force=0 (0.003s)
        [14] => SELECT cid, name, description, thumb FROM cpg11d_categories WHERE parent = ''  ORDER BY pos (0.003s)
        [15] => SELECT aid FROM cpg11d_albums as a WHERE category>=10000 (0.002s)
        [16] => SELECT count(*) FROM cpg11d_pictures as p, cpg11d_albums as a WHERE p.aid = a.aid AND category >= 10000 (0.091s)
        [17] => SELECT cid, name, description, thumb FROM cpg11d_categories WHERE parent = '1'  ORDER BY pos (0.003s)
        [18] => SELECT aid FROM cpg11d_albums WHERE category = 2 (0.006s)
        [19] => SELECT count(*) FROM cpg11d_pictures as p, cpg11d_albums as a WHERE p.aid = a.aid AND category = 2 (0.017s)
        [20] => SELECT count(*) FROM cpg11d_albums as a WHERE category = '2' (0.934s)
        [21] => SELECT a.aid, a.title, a.description, visibility, filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_albums as a LEFT JOIN cpg11d_pictures as p ON a.thumb=p.pid WHERE category=2 ORDER BY a.pos LIMIT 0,25 (0.012s)
        [22] => SELECT a.aid, count( p.pid )  AS pic_count, max( p.pid )  AS last_pid, max( p.ctime )  AS last_upload, a.keyword FROM cpg11d_albums AS a  LEFT JOIN cpg11d_pictures AS p ON a.aid = p.aid AND p.approved =  'YES' WHERE a.aid IN (131, 139, 141, 149, 182, 184, 187, 188, 189, 224, 226, 227, 228, 230, 256, 270, 271, 272, 276, 277, 287, 293, 296, 300, 301)GROUP BY a.aid (8.222s)
        [23] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='4249' (0.003s)
        [24] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='5583' (0.002s)
        [25] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='7238' (0.002s)
        [26] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='7251' (0.002s)
        [27] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='7729' (0.002s)
        [28] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='7766' (0.002s)
        [29] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='7818' (0.003s)
        [30] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='7841' (0.002s)
        [31] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='8981' (0.002s)
        [32] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='9705' (0.002s)
        [33] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='9707' (0.002s)
        [34] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='10329' (0.002s)
        [35] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='10069' (0.002s)
        [36] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='10072' (0.002s)
        [37] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='10316' (0.002s)
        [38] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='10354' (0.002s)
        [39] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='10369' (0.002s)
        [40] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='10452' (0.002s)
        [41] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='10600' (0.033s)
        [42] => SELECT cid, name, description, thumb FROM cpg11d_categories WHERE parent = '2'  ORDER BY pos (0.004s)
        [43] => SELECT aid FROM cpg11d_albums WHERE category = 5 (0.036s)
        [44] => SELECT count(*) FROM cpg11d_pictures as p, cpg11d_albums as a WHERE p.aid = a.aid AND category = 5 (0.05s)
        [45] => SELECT aid FROM cpg11d_albums WHERE category = 3 (0.006s)
        [46] => SELECT count(*) FROM cpg11d_pictures as p, cpg11d_albums as a WHERE p.aid = a.aid AND category = 3 (0.008s)
        [47] => SELECT count(*) FROM cpg11d_albums as a WHERE category = '3' (0.002s)
        [48] => SELECT a.aid, a.title, a.description, visibility, filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_albums as a LEFT JOIN cpg11d_pictures as p ON a.thumb=p.pid WHERE category=3 ORDER BY a.pos LIMIT 0,25 (0.044s)
        [49] => SELECT a.aid, count( p.pid )  AS pic_count, max( p.pid )  AS last_pid, max( p.ctime )  AS last_upload, a.keyword FROM cpg11d_albums AS a  LEFT JOIN cpg11d_pictures AS p ON a.aid = p.aid AND p.approved =  'YES' WHERE a.aid IN (303, 304, 203, 223, 225, 229, 231, 255, 257, 267, 268, 269, 281, 283, 284, 289, 290, 291, 221, 219, 216, 204, 205, 207, 208)GROUP BY a.aid (0.054s)
        [50] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='10714' (0.003s)
        [51] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='10715' (0.043s)
        [52] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='7676' (0.002s)
        [53] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='7730' (0.002s)
        [54] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='7842' (0.003s)
        [55] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='7848' (0.002s)
        [56] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='8969' (0.002s)
        [57] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='8984' (0.002s)
        [58] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='9699' (0.002s)
        [59] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='9701' (0.002s)
        [60] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='9703' (0.002s)
        [61] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='10243' (0.035s)
        [62] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='10305' (0.002s)
        [63] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='10308' (0.002s)
        [64] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='10333' (0.002s)
        [65] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='10334' (0.002s)
        [66] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='10335' (0.002s)
        [67] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='7723' (0.002s)
        [68] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='7718' (0.002s)
        [69] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='7709' (0.002s)
        [70] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='7678' (0.002s)
        [71] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='7680' (0.003s)
        [72] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='7687' (0.035s)
        [73] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='7689' (0.003s)
        [74] => SELECT cid, name, description, thumb FROM cpg11d_categories WHERE parent = '3'  ORDER BY pos (0.004s)
        [75] => SELECT aid FROM cpg11d_albums WHERE category = 21 (0.002s)
        [76] => SELECT count(*) FROM cpg11d_pictures as p, cpg11d_albums as a WHERE p.aid = a.aid AND category = 21 (0.003s)
        [77] => SELECT aid FROM cpg11d_albums WHERE category = 23 (0.005s)
        [78] => SELECT count(*) FROM cpg11d_pictures as p, cpg11d_albums as a WHERE p.aid = a.aid AND category = 23 (0.039s)
        [79] => SELECT aid FROM cpg11d_albums WHERE category = 24 (0.006s)
        [80] => SELECT count(*) FROM cpg11d_pictures as p, cpg11d_albums as a WHERE p.aid = a.aid AND category = 24 (0.008s)
        [81] => SELECT aid FROM cpg11d_albums WHERE category = 4 (0.004s)
        [82] => SELECT count(*) FROM cpg11d_pictures as p, cpg11d_albums as a WHERE p.aid = a.aid AND category = 4 (0.031s)
        [83] => SELECT count(*) FROM cpg11d_albums as a WHERE category = '4' (0.002s)
        [84] => SELECT a.aid, a.title, a.description, visibility, filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_albums as a LEFT JOIN cpg11d_pictures as p ON a.thumb=p.pid WHERE category=4 ORDER BY a.pos LIMIT 0,23 (0.027s)
        [85] => SELECT a.aid, count( p.pid )  AS pic_count, max( p.pid )  AS last_pid, max( p.ctime )  AS last_upload, a.keyword FROM cpg11d_albums AS a  LEFT JOIN cpg11d_pictures AS p ON a.aid = p.aid AND p.approved =  'YES' WHERE a.aid IN (206, 190, 197, 220, 274, 275, 292, 294, 295, 305, 130, 135, 136, 144, 145, 150, 161, 16, 115, 116, 117, 118, 119)GROUP BY a.aid (0.45s)
        [86] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='7685' (0.003s)
        [87] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='7580' (0.002s)
        [88] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='7720' (0.002s)
        [89] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='9901' (0.002s)
        [90] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='9995' (1.279s)
        [91] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='10336' (0.002s)
        [92] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='10358' (0.002s)
        [93] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='10359' (0.002s)
        [94] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='10716' (0.002s)
        [95] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='4640' (0.002s)
        [96] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='4949' (0.002s)
        [97] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='5077' (0.003s)
        [98] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='5730' (0.003s)
        [99] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='5758' (0.003s)
        [100] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='7252' (1.259s)
        [101] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='3329' (0.002s)
        [102] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='3130' (0.002s)
        [103] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='4114' (0.002s)
        [104] => SELECT filepath, filename, url_prefix, pwidth, pheight FROM cpg11d_pictures WHERE pid='3033' (0.002s)
        [105] => SELECT cid, name, description, thumb FROM cpg11d_categories WHERE parent = '4'  ORDER BY pos (0.004s)
        [106] => SELECT aid FROM cpg11d_albums as a WHERE category = '0' (0.005s)
        [107] => SELECT count(*) FROM cpg11d_albums as a WHERE 1 (0.001s)
        [108] => SELECT count(*) FROM cpg11d_pictures as p LEFT JOIN cpg11d_albums as a ON a.aid=p.aid WHERE 1 (3.171s)
        [109] => SELECT count(*) FROM cpg11d_comments as c LEFT JOIN cpg11d_pictures as p ON c.pid=p.pid LEFT JOIN cpg11d_albums as a ON a.aid=p.aid WHERE 1 (3.307s)
        [110] => SELECT count(*) FROM cpg11d_categories WHERE 1 (0.002s)
        [111] => SELECT sum(hits) FROM cpg11d_pictures as p LEFT JOIN cpg11d_albums as a ON p.aid=a.aid WHERE 1 (2.344s)
        [112] => SELECT COUNT(*) FROM cpg11d_pictures WHERE approved = 'NO' (0.07s)
        [113] => SELECT COUNT(*) from cpg11d_pictures WHERE approved = 'YES' AND hits > 0    (0.346s)
        [114] => SELECT * FROM cpg11d_pictures WHERE approved = 'YES'AND hits > 0   ORDER BY hits DESC, filename   LIMIT 0 ,8 (0.961s)
        [115] => SELECT count(*) FROM cpg11d_albums as a WHERE category = '0' (0.002s)
    )

    ==========================
    GET :
    ------------------
    Array
    (
    )

    ==========================
    POST :
    ------------------
    Array
    (
    )

    ==========================
    VERSION INFO :
    ------------------
    PHP version: 5.0.4 - OK
    ------------------
    mySQL version: 4.1.20
    ------------------
    Coppermine version: 1.4.3(stable)
    ==========================
    Module: gd
    ------------------
    module doesn't exist
    ==========================
    Module: mysql
    ------------------
    MySQL Supportenabled
    Active Persistent Links 0
    Active Links 1
    Client API version 4.1.20
    MYSQL_MODULE_TYPE external
    MYSQL_SOCKET /var/lib/mysql/mysql.sock
    MYSQL_INCLUDE -I/usr/include/mysql
    MYSQL_LIBS -L/usr/lib/mysql -lmysqlclient 
    ==========================
    Module: zlib
    ------------------
    ZLib Support enabled
    Compiled Version 1.2.2.2
    Linked Version 1.2.2.2
    ==========================
    Server restrictions (safe mode)?
    ------------------
    Directive | Local Value | Master Value
    safe_mode | Off | Off
    safe_mode_exec_dir | no value | no value
    safe_mode_gid | Off | Off
    safe_mode_include_dir | no value | no value
    safe_mode_exec_dir | no value | no value
    sql.safe_mode | Off | Off
    disable_functions | no value | no value
    file_uploads | On | On
    include_path | .:/usr/share/pear | .:/usr/share/pear
    open_basedir | no value | no value
    ==========================
    email
    ------------------
    Directive | Local Value | Master Value
    sendmail_from | no value | no value
    sendmail_path | /usr/sbin/sendmail -t -i | /usr/sbin/sendmail -t -i
    SMTP | localhost | localhost
    smtp_port | 25 | 25
    ==========================
    Size and Time
    ------------------
    Directive | Local Value | Master Value
    max_execution_time | 30 | 30
    max_input_time | 60 | 60
    upload_max_filesize | 2M | 2M
    post_max_size | 8M | 8M
    ==========================
    Page generated in 24.698 seconds - 116 queries in 23.131 seconds - Album set : ; Meta set: ;
« Last Edit: October 29, 2006, 06:59:47 am by Sami »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Slow queries on 1.4.3
« Reply #1 on: October 26, 2006, 07:11:08 pm »

Your site is outdated (cpg1.4.3), it's mandatory to upgrade (as suggested in the docs), most recent version currently is cpg1.4.9.
Try removing the "most viewed" meta album and see if this reduces your query time significantly.

In the future, when posting links to your site, make sure to post a warning with it that it is not worksafe! Modified your posting accordingly.

Joachim
Logged

jp-photo.dk

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 36
    • JP-photo.dk
Re: Slow queries on 1.4.3
« Reply #2 on: October 28, 2006, 11:40:28 pm »

Oh yes, sorry about leaving out the warning, I didn't think of it.

Before upgrading to cpg1.4.9 i removed the "most viewed" and this reduced the time somewhat. Also I optimized the configuration of Mysql and this helped some too.

After the upgrade to cpg1.4.9 the query time stayed the same and is quite acceptable.

The final problem with loadtimes is with the filesizes of the thumbnails, but that question should belong in the upload-category of the forum I believe.

Thank you very much for your help.

Regards,
Jan
Logged
Pages: [1]   Go Up
 

Page created in 0.026 seconds with 20 queries.