Enable Logging of Slow Queries (Slow Query Log) in MySQL Database Įjungti registravimas Slow queries (Žemas Užklausa Prisijungti) MySQL duomenų bazė

One of the main requirements for a fast Vienas iš pagrindinių reikalavimų greitai web server interneto serveryje is to has efficient and effective SQL statements or queries that are optimized. yra yra veiksminga ir efektyvi SQL arba užklausų, optimizuoti. Any non-optimal SQL (Structured Query Language) commands or statements that take too long or lengthy time to execute will use up a lot of system resources, causing Bet ne optimalus SQL (Structured Query Language) komandos arba pareiškimus, kad pernelyg ilgai arba ilgas laiko atlikti bus panaudoti daug sistemos išteklių, todėl MySQL MySQL database to run slower, and then more and more queries backlogs queuing up, and when connection limit is reached, visitors are been denied or refused connection. Duomenų bazės vykdyti lėčiau, tada daugiau užklausų vėlavimu eilės aukštyn ir ryšį ribą, lankytojų atmestas arba atsisakytus ryšį. In worst case scenario, your web server will go down as well, or continuously underperform. Į blogiausio atvejo scenarijų, savo interneto serverio vyks taip pat, arba nuolat nepakankamai veiksmingai. The case is especially true when you are using MyISAM table type which uses table-level locking instead of row-level locking in a high traffic website. Šiuo atveju yra ypač aktualu, kai naudojate MyISAM lentelės tipo, kurį naudoja stalo lygio fiksavimo vietoj eilutės lygio fiksavimo į didelį eismo svetainėje.

Sometime, a single SQL query may be the cause of all the server's problems. Kartais, vienu SQL užklausa gali sukelti visų serverio problemos. MySQL has built-in functionality to capture slow query log or identify queries that are not optimal and take a long time to finish, which allows you to log all slow running queries which took over defined number of seconds to execute by MySQL database engine to a file. MySQL turi įmontuotą funkciją surinkimo lėtai užklausa prisijungti arba nustatyti klausimus, kurie nėra optimalus ir ilgai užtrukti iki pabaigos, kuri leidžia prisijungti visiems lėtai veikia užklausų perėmė apibrėžto skaičiaus sekundžių vykdyti MySQL duomenų bazės į failas. Slow query log is not activated or on by default MySQL installation, thus it is one of the less-used logs. Žemas užklausą žurnalo nėra aktyvuotas arba pagal nutylėjimą MySQL įrenginys, todėl vienas iš mažiau naudojamų žurnalų.

To enable slow query log, simply add the following line to MySQL configuration file (my.cnf or my.ini), and then restart the MySQL server: Kad lėtai užklausą prisijungti, paprasčiausiai pridėkite šią eilutę į MySQL konfigūracijos failo (my.cnf arba my.ini) ir paleiskite serverį MySQL:

log-slow-queries log-lėtai užklausos

or arba

log-slow-queries = [path to the log file] log-lėtai queries = [kelias iki failo žurnalo]

Replace [path to the log file] with actual path to the slow query log file you want the MySQL to write the log to, which is the optional value. Pakeisti [kelią iki failo žurnalo] realiam kelią lėtai užklausą žurnalo failą norite MySQL rašyti žurnalą, kuris yra pasirinktinai vertės.

Or you can start mysqld with with the –log-slow-queries[=file_name] option to enable the slow query log. Arba galite pradėti name su su-log-lėtai užklausas [= nazwa_pliku] įjungti lėta užklausa prisijungti. In both syntaxes, if not log file name is specified, the default name is host_name -slow.log, stored in the MySQL data file directory. Abiem syntaxes, jei nepavyksta prisijungti failo pavadinimas yra nurodyta, numatytasis pavadinimas host_name-slow.log, saugomi MySQL duomenų rinkmeną kataloge. If a filename is given, but not as an absolute pathname, the server writes the file in the data directory too. Jei failo pavadinime yra teikiama, bet ne kaip absoliutus kelias, serveris įrašo failą kataloge duomenų per.

After enabling slow query log, MySQL will create, capture and log to the log file with all SQL statements that took more than long_query_time seconds to execute, which is by default set to 10 seconds. Įjungus lėtai užklausą prisijungti, MySQL bus sukurti, surinkimo ir prisijunkite prie log failą su SQL, kad prireikė daugiau nei long_query_time sekundžių vykdyti, kuri yra pagal nutylėjimą nustatytas 10 sekundžių. The time to acquire the initial table locks is not counted as execution time. Metu įgyti pradinės lentelės spynos nėra skaičiuojami kaip vykdymo laiką. mysqld writes a statement to the slow query log after it has been executed and after all locks have been released, so log order might be different from execution order. name rašė pareiškimą lėtai užklausa prisijungti po to, kai jis buvo įvykdytas ir po visų spynos buvo išleista, todėl prisijungti tvarka gali skirtis nuo vykdymo tvarka.

You can then examine all the SQL queries that took longer than the pre-defined number of seconds (10 seconds by default) in the host_name -slow.log, and then take the necessary steps to optimize the SQL statements. Tada galite patikrinti visų SQL užklausų kad užtruko ilgiau nei iš anksto apibrėžto skaičiaus sekundžių (10 sekundžių pagal nutylėjimą) į host_name-slow.log, ir imtis būtinų veiksmų siekiant optimizuoti SQL pareiškimus. The slow query log will tell you about what was time the query completed, how long the query took to run, how long it took to secure its locks, how many rows were sent back as a result, how many rows were examined to determine the result, which database was used, and the actual query itself. Lėtai užklausa prisijungti papasakos Jums apie tai buvo laikas užklausą baigtas, kaip ilgai užklausa prireikė skaičiuoti, kiek laiko ji ėmėsi užtikrinti spynos, kiek eilučių buvo išsiųsti atgal, kaip rezultatas, kiek eilučių buvo ištirti, siekiant nustatyti rezultatas, o duomenų bazė buvo naudojamas, ir faktinį užklausą pati. But bear in mind that a SQL query contained in the log may have already optimum, but executed slowly due to the system resources been used up by the actual slow statement that need to be fine tuned. Bet atminti, kad SQL užklausos esančius prisijungti jau optimalų, bet įgyvendinamos lėtai dėl sistemos ištekliai buvo panaudoti pagal faktinį lėtai, kad reikia gerai suderinti.

IMPORTANT : The page is machine translated and provided "as is" without warranty. DĖMESIO: Šis puslapis yra mašina išvertė ir pateikiama "kaip yra" be garantijų. Machine translation may be difficult to understand. Mašininio vertimo, gali būti sunku suprasti. Please refer to Remkitės original English article originalas anglų straipsnis whenever possible. jei įmanoma.


5 Responses to “Enable Logging of Slow Queries (Slow Query Log) in MySQL Database” 5 Responses to "Įjungti registravimas Slow queries (Žemas Užklausa Prisijungti) MySQL duomenų bazė"

  1. kain Kain
    July 18th, 2009 02:23 18 liepa 2009 02:23
    5 5

    when you go to my.cf you will see that by default the lines Kai jūs einate į my.cf pamatysite, kad pagal nutylėjimą linijų

    log_slow_queries = /var/log/mysql/mysql-slow.log & log_slow_queries = / var / log / mysql / mysql-slow.log &
    long_query_time = 1 long_query_time = 1

    are commented out, however, the next line yra komentarų, tačiau, kitą eilutę

    log-queries-not-using-indexes log-užklausų-ne-naudojant-indeksus

    is not, so if you enable slow query logging then by default all queries not using indexes will show up in that log. nėra, todėl, jei leidžia lėtai užklausą prisijungiant tada pagal nutylėjimą visų užklausų nenaudojate indeksus bus rodomi tame žurnale. For most DBs this will be a ton of data which is why your logs are filling up so quickly. Daugumai duomenų bazę tai bus t duomenų, todėl jūsų žurnalai pildo taip greitai.

    My suggestion is comment out this line Mano pasiūlymas yra jame šią eilutę

    log-queries-not-using-indexes log-užklausų-ne-naudojant-indeksus

    and change the long_query_time value to something low like 1 or 2, this should give you some meaningful results with which to start from. ir pakeisti long_query_time vertės kažkas mažo kaip 1 arba 2, tai turi duoti jums keletą reikšmingus rezultatus, kurie turi būti pradėti nuo.

    If you still get no results it might be that you have no slow queries in which case you should uncomment out the line Jei vis dar negaunate rezultatų, gali būti, kad jūs neturite lėtai užklausų Tokiu atveju jums reikėtų odkomentować iš linijos

    log-queries-not-using-indexes log-užklausų-ne-naudojant-indeksus

    and start trying to index some of those queries. ir pradėti bando indeksas kai kurie iš šių klausimų.

    hope that helps someone tikiuosi, kad padeda kažkas

    -Kain -Kain

  2. Robert Nolan Robertas Nolan
    February 20th, 2009 21:29 Vasaris 20, 2009 21:29
    4 4

    I use MONyog Query analyzer to analyze slow queries. Aš naudoju MONyog Query Analyzer analizė lėtai užklausas. It works flawlessly. Jis dirba nepriekaištingai.

  3. Commander1024 Commander1024
    December 19th, 2008 19:37 Gruodžio 19 d. 2008 19:37
    3 3

    I can't really confirm this – I enabled slow loggin in the appropiate config file (debian lenny, mysql 5.0 latest) because I HAD “some” slow queries before. Mes negalime patvirtinti šio - Aš leido lėtai loggin į atitinkamus konfigūracijos failo (debian lenny, mysql 5,0 naujausia), nes aš HAD "kai kurių" lėtas queries anksčiau.
    After enabling there are thousands of “slow queries” being logged – The slow limit is set to the default of 10 sec. Įjungus yra tūkstančiai "lėtas užklausas" registruojami - Lėtai limitas yra nustatytas pagal nutylėjimą yra 10 sekundžių. This is really nonsense as there can't be a >10sec query when the whole page is being calculated, by php, tranferred over the net and rendered on the client browser in under 5 sec Tai tikrai nesąmonė, nes negali būti> 10sec užklausą, kai visą puslapį yra apskaičiuojamas pagal Php, pervedamas per tinklą ir lydyti į kliento naršyklę, po 5 sekundžių

    greetings Marcus sveikinimai Marcus

  4. misrnt misrnt
    November 1st, 2008 18:48 Lapkričio 1 d. 2008 18:48
    2 2

    i try to do that but this message appeared Aš stengiuosi daryti, bet šį pranešimą paaiškėjo,

    081101 5:34:51 [ERROR] Fatal error: Please read “Security” section of the manual to find out how to run mysqld as root! 081101 5:34:51 [ERROR] Fatal error: Prašome perskaityti skyrelyje "Saugumas" vadovu ir sužinokite, kaip paleisti mysqld kaip root!

    081101 5:34:51 [ERROR] Aborting 081101 5:34:51 [KLAIDA] Aborting

    081101 5:34:51 [Note] mysqld: Shutdown complete 081101 5:34:51 [Pastaba] name: shutdown užpildyti

    what should i do in this case? Ką daryti tokiu atveju?

  5. Change or Set MySQL Long Query Time Value for log-slow-queries » My Digital Life Keisti arba Nustatyti MySQL Ilgalaikė Query Time Vertė log-lėtai queries »Mano skaitmeninis gyvenimas
    January 23rd, 2007 00:22 Sausis 23, 2007 00:22
    1 1

    [...] If you enable slow queries log of MySQL database server, you will notice that from the slow query log file contains only SQL statements and queries that took more than query_time of 10 seconds to execute or run. [...] Jei įjungsite lėtai užklausų istorija MySQL duomenų bazių serveris, jūs pastebėsite, kad iš lėto užklausą žurnalo faile yra tik SQL pareiškimus ir prašymus, kad prireikė daugiau nei query_time 10 sekundžių atlikti arba paleisti. This is the default value or query time threshold for log_slow_queries function, which is 10 seconds. Tai numatytoji vertė arba užklausą laiko riba log_slow_queries funkciją, kuri yra 10 sekundžių. 10 seconds is way too long for a SQL query to complete, so the value may be too high to capture any meaningful data. 10 sekundžių yra per daug ilgas SQL užklausą, todėl vertė gali būti per didelis fiksuoti bet kokius reikšmingus duomenis. You can alter or change the slow query time to lower value or number of seconds. Galite pakeisti ar pakeisti lėtai užklausą laiko žemesniąją vertę arba skaičių sekundžių. You can set a new long_query_time in the MySQL configuration file, namely my.cnf or my.ini, normally located in /etc directory. Jūs galite nustatyti naują long_query_time į MySQL konfigūracijos failą, būtent my.cnf arba my.ini, paprastai esančių / etc. Simply add the following line to the configuration file: [...] Tiesiog pridėkite šią eilutę failo konfigūracija: [...]

Leave a Reply Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> Galite naudoti šias žymeles: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime = ""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to comments feature has been disabled. Subscribe to comments funkcija buvo išjungta. To receive notification of latest comments posted, subscribe to Norėdami gauti pranešimus apie naujausius komentarų, užsiprenumeruoti My Digital Life Comments RSS feed Mano skaitmeninis gyvenimas Komentarų RSS or arba register to receive registruotis, norint gauti new comments in daily email digest. Nauji komentarai kasdien elektroniniu paštu.
Custom Search

New Articles Nauji straipsniai

Incoming Search Terms for the Article Incoming Paieška Sąlygos straipsnį

slow query log lėtai prašymą prisijungti - -- enable slow query log kad lėtai prašymą prisijungti - -- mysql enable slow query log mysql kad lėtai užklausa prisijungti - -- mysql slow query log mysql lėtai užklausa prisijungti - -- mysql slow query log my.cnf mysql lėtai užklausa prisijungti my.cnf - -- log-slow-queries log-lėtai užklausos - -- mysql log slow queries my.cnf mysql prisijungti lėtai queries my.cnf - -- mysql slow query log enable mysql lėtai užklausa prisijungti leidžia - -- log slow queries prisijungti lėtai užklausos - -- mysql log slow queries mysql prisijungti lėtai užklausos - -- mysql slow query mysql lėtai užklausą - -- enable the slow query log kad lėtai užklausa prisijungti - -- slow query log my.cnf lėtai užklausa prisijungti my.cnf - -- enable mysql slow query log kad mysql lėtai užklausa prisijungti - -- log slow queries mysql prisijungti lėtai queries mysql - -- mysql turn on slow query log mysql įjungti lėtai užklausa prisijungti - -- my.cnf slow query log my.cnf lėtai prašymą prisijungti - -- log slow queries my.cnf prisijungti lėtai queries my.cnf - -- my.ini log my.ini prisijungti - -- MYSQL LOG queries MySQL ĮĖJIMAS užklausos - -- how to enable slow query log kaip įjungti lėta užklausa prisijungti - -- enable mysql log kad mysql prisijungti - -- log-slow-queries my.cnf log-lėtai queries my.cnf - -- my.cnf slow query my.cnf lėtai užklausą - -- enable slow query log mysql kad lėtai užklausa prisijungti mysql - -- log slow query prisijungti lėtai užklausą - -- slow query logging lėtai prašymą prisijungti - -- mysql enable slow query mysql kad lėtai užklausą - -- my.ini slow query log my.ini lėtai prašymą prisijungti - -- log-slow-queries my.ini log-lėtai queries my.ini - -- MySQL Query Log MySQL Query Prisijungti - -- my.cnf slow log my.cnf lėtai prisijungti - -- enable slow query kad lėtai užklausą - -- mysql enable slow queries mysql kad lėtai užklausos - -- mysql log-slow-queries my.cnf mysql prisijungti-lėtai queries my.cnf - -- enable slow queries kad lėtai užklausos - -- slow query log Mysql lėtai užklausa prisijungti Mysql - -- my.cnf slow queries my.cnf lėtai užklausos - -- Enable the slow query log Įjungti lėtai užklausa prisijungti - -- mysql log long queries mysql prisijungti ilgas užklausos - -- mysql slow query enable mysql lėtai prašymo suteikti - -- my.cnf query log my.cnf prašymą prisijungti - -- turn on slow query log mysql įjungti lėta užklausa prisijungti mysql - -- turn on slow query log įjungti lėta užklausa prisijungti - -- mysql log-slow-queries mysql prisijungti-lėtai užklausos - -- mysql slow queries log mysql lėtai užklausų istorija - -- mysql slow query log location mysql lėtai užklausą žurnalo vietą - -- mysql slow query log configuration mysql lėtai užklausa prisijungti konfigūracijos - -- slow queries my.cnf lėtai queries my.cnf - -- enable mysql slow queries kad mysql lėtai užklausos - -- mysql Turn on slow query logging mysql Įjungti lėtai užklausa prisijungti - -- mysql log slow query mysql prisijungti lėtai užklausą - -- mysql enable slow query log my.cnf mysql kad lėtai užklausa prisijungti my.cnf - -- enabling slow query log leidžia lėtai prašymą prisijungti - -- turn on mysql slow query log įjungti mysql lėtai užklausa prisijungti - -- enable mysql logging kad mysql prisijungti - -- my.ini log-slow-queries my.ini log-lėtai užklausos - -- mysql enable logging mysql įjungti registravimą - -- enable mysql logs kad mysql rąstų - -- my.ini logging my.ini prisijungti - -- slow_query_log my.cnf slow_query_log my.cnf - -- how to set slowquery log in windos using my.cnf or my.ini in mysql 4.1 kaip nustatyti slowquery prisijungti windos naudojant my.cnf arba my.ini į mysql 4,1 - -- my.cnf log queries my.cnf istorija užklausų - -- mysql enable log slow queries mysql leidžia prisijungti lėtai užklausos - -- mysql slow log mysql lėtai prisijungti - -- mysql log level mysql prisijungti lygis - -- mysql log query mysql prisijungti užklausą - -- how to enable slow query in mysql kaip įjungti lėta užklausą mysql - -- my.cnf log-slow-queries my.cnf log-lėtai užklausos - -- mysql long query time mysql ilgas užklausos metu - -- Enabling slow query log in mysql Įjungus lėtai užklausa prisijungti mysql - -- my.cnf log my.cnf prisijungti - -- mysql enable slow log mysql kad lėtai prisijungti - -- slow log my.cnf lėtai prisijungti my.cnf - -- how to enable slow query log in mysql kaip įjungti lėta užklausa prisijungti mysql - --