afficher requêtes exécutées (Créer un compte)

  • Statut : non résolu
3 sujets de 1 à 3 (sur un total de 3)
  • Auteur
    Messages
  • #454879
    geekubuntu
    Participant
    Chevalier WordPress
    286 contributions

    Bonjour,

    Ma configuration WP actuelle
    – Version de WordPress : 2.3.1
    – Nom de l’hebergeur : en local

    Problème(s) rencontré(s) :
    je cherche comment afficher les requêtes mysql exécutées, c’est à dire l’affichage complet de chaque requête avec leur tps d’éxécution individuel…c’est pour faire des test: la requête la plus longue,etc… possible?

    #612888
    Qwindoo
    Modérateur
    Maître WordPress
    2861 contributions

    Hello 🙂

    J’avais justement réussi à afficher la liste des requêtes en modifiant quelques fichiers systèmes… j’essaie de te retrouver les manipulations à faire 😉

    Cordialement,
    Thomas

    edit: Modifications à effectuer :

    1. Ajouter la ligne suivante dans le fichier wp-config.php : [c]define(‘SAVEQUERIES’, true);[/c]
    2. Ajouter le code suivant dans le fichier footer.php du thème :

    <!– Detailed list of WordPress SQL Queries
    queries); ?>
    –>

    … ce qui donne chez moi :

    <!-- Detailed list of WordPress SQL Queries
    Array
    (
    [0] =>--> Array
    (
    [0] => SELECT option_value FROM wp_options WHERE option_name = ‘siteurl’
    [1] => 0.0021331310272217
    )

    [1] => Array
    (
    [0] => SELECT ID FROM wp_users WHERE user_login = ‘admin’
    [1] => 0.0013449192047119
    )

    [2] => Array
    (
    [0] => SELECT * FROM wp_users WHERE ID = ‘1’ LIMIT 1
    [1] => 0.00081515312194824
    )

    [3] => Array
    (
    [0] => SELECT meta_key, meta_value FROM wp_usermeta WHERE user_id = ‘1’
    [1] => 0.0011940002441406
    )

    [4] => Array
    (
    [0] => SELECT option_value FROM wp_options WHERE option_name = ‘siteurl’
    [1] => 0.00069093704223633
    )

    [5] => Array
    (
    [0] => SELECT option_value FROM wp_options WHERE option_name = ‘widget_text’ LIMIT 1
    [1] => 0.0006859302520752
    )

    [6] => Array
    (
    [0] => SELECT option_value FROM wp_options WHERE option_name = ‘widget_rss’ LIMIT 1
    [1] => 0.0006721019744873
    )

    [7] => Array
    (
    [0] => SELECT option_value FROM wp_options WHERE option_name = ‘sidebars_widgets’ LIMIT 1
    [1] => 0.00070714950561523
    )

    [8] => Array
    (
    [0] => SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts WHERE 1=1 AND post_type = ‘post’ AND (post_status = ‘publish’ OR post_status = ‘private’) ORDER BY post_date DESC LIMIT 0, 3
    [1] => 0.0031909942626953
    )

    [9] => Array
    (
    [0] => SELECT FOUND_ROWS()
    [1] => 0.00052404403686523
    )

    [10] => Array
    (
    [0] => SELECT t.*, tt.*, tr.object_id FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN (‘category’, ‘post_tag’) AND tr.object_id IN (75, 76, 74) ORDER BY t.name ASC
    [1] => 0.0020060539245605
    )

    [11] => Array
    (
    [0] => SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN(75,76,74) ORDER BY post_id, meta_key
    [1] => 0.0011768341064453
    )

    [12] => Array
    (
    [0] => SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM wp_posts WHERE post_type = ‘post’ AND post_status = ‘publish’ GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC
    [1] => 0.0011930465698242
    )

    [13] => Array
    (
    [0] => SELECT tr.object_id FROM wp_term_relationships AS tr INNER JOIN wp_term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN (‘category’) AND tt.term_id IN (’17’) ORDER BY tr.object_id ASC
    [1] => 0.00092005729675293
    )

    [14] => Array
    (
    [0] => SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.ID NOT IN (’76’) AND post_type = ‘post’ AND (post_status = ‘publish’ OR post_status = ‘private’) GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0, 3
    [1] => 0.0026941299438477
    )

    [15] => Array
    (
    [0] => SELECT FOUND_ROWS()
    [1] => 0.0006248950958252
    )

    [16] => Array
    (
    [0] => SELECT t.*, tt.*, tr.object_id FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN wp_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN (‘category’, ‘post_tag’) AND tr.object_id IN (72) ORDER BY t.name ASC
    [1] => 0.0014750957489014
    )

    [17] => Array
    (
    [0] => SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN(72) ORDER BY post_id, meta_key
    [1] => 0.0012400150299072
    )

    [18] => Array
    (
    [0] => SELECT COUNT(id) FROM wp_dBClicks WHERE dBFile = ‘http://www.newbie-project.net/downloads/newbie-directory/newbie-directory_1.2.zip’
    [1] => 0.0049018859863281
    )

    [19] => Array
    (
    [0] => SELECT dBIcon from wp_dBFiletypes WHERE dBExt = ‘.zip’
    [1] => 0.0014388561248779
    )

    [20] => Array
    (
    [0] => SELECT COUNT(id) FROM wp_dBClicks WHERE dBFile = ‘http://www.newbie-project.net/downloads/newbie-directory/newbie-directory_1.1.zip’
    [1] => 0.004425048828125
    )

    [21] => Array
    (
    [0] => SELECT * FROM wp_dday WHERE ddayID = 2
    [1] => 0.0013258457183838
    )

    [22] => Array
    (
    [0] => SELECT * FROM wp_dday WHERE ddayID = 3
    [1] => 0.0010929107666016
    )

    [23] => Array
    (
    [0] => SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN (‘category’) ORDER BY t.term_id ASC
    [1] => 0.0021390914916992
    )

    [24] => Array
    (
    [0] => SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM wp_posts WHERE post_type = ‘post’ AND post_status = ‘publish’ GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC LIMIT 12
    [1] => 0.0018129348754883
    )

    [25] => Array
    (
    [0] => DELETE FROM wp_onlinecounter WHERE oc_timestamp 0.00094103813171387
    )

    [26] => Array
    (
    [0] => SELECT oc_timestamp FROM wp_onlinecounter WHERE oc_ip = ‘83.194.62.37’
    [1] => 0.00079607963562012
    )

    [27] => Array
    (
    [0] => UPDATE wp_onlinecounter SET oc_timestamp = 1193500011 WHERE oc_ip = ‘83.194.62.37’
    [1] => 0.0010280609130859
    )

    [28] => Array
    (
    [0] => SELECT COUNT(oc_ip) FROM wp_onlinecounter
    [1] => 0.00067400932312012
    )

    [29] => Array
    (
    [0] => SELECT * , IF (DATE_ADD(link_updated, INTERVAL 120 MINUTE) >= NOW(), 1,0) as recently_updated , UNIX_TIMESTAMP(link_updated) AS link_updated_f FROM wp_links WHERE 1=1 AND link_visible = ‘Y’ ORDER BY link_name ASC
    [1] => 0.0016469955444336
    )

    )
    –>

    #612889
    Boyquotes
    Participant
    Initié WordPress
    1 contributions

    Merci,

    presque 5 ans après toujours d’actualité, je vais pouvoir debuguer mon code 🙂

    Wordpress 3.3.2.

3 sujets de 1 à 3 (sur un total de 3)
  • Vous devez être connecté pour répondre à ce sujet.