Jump to content
php.lv forumi

Kā lai saprot log_slow_queries MySql


Sasa

Recommended Posts

my.conf failā ir šādi:

# Here you can see queries with especially long duration
log_slow_queries	= /var/log/mysql/mysql-slow.log
long_query_time = 2
log-queries-not-using-indexes

Tālāk skatos mysql-slow.log failu:


SELECT
        payed.*,
        firmas_links.*
FROM
payed
JOIN firmas_links ON firmas_links.id=payed.elem_id
WHERE
payed.fdate<=NOW()
AND payed.tdate>=NOW()
AND (payed.etype="lr" or payed.etype="lb") ORDER BY payed.etype DESC,RAND();
# User@Host: companies[companies] @ localhost []
# Query_time: 0.000378  Lock_time: 0.000065 Rows_sent: 0  Rows_examined: 27

Nesaprotu Query_time ir 0.000378 vai tas ir ilgāk kā man konfigurācijā norādīts?  

Edited by Sasa
Link to comment
Share on other sites

Interesanti tev tie tabulu nosaukumi, ne ta angliski, ne latviski...

 

Tas kverijs neizmanto indeksus, tāpēc tiek ielogots. To dara "log-queries-not-using-indexes". Tas konfigs ignorē "long_query_time".

Tā kā laiks uzlikt indeksus uz "payed.etype" un "payed.fdate/tdate".

Edited by jurchiks
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...