Enable Logging of Slow Queries (Slow Query Log) in MySQL Database Enable iegrāmatošana Lēna vaicājumu (Lēna Query Log) in MySQL Database

One of the main requirements for a fast Viena no galvenajām prasībām, lai ātri web server tīmekļa serveris is to has efficient and effective SQL statements or queries that are optimized. ir, ir efektīvs un efektīvu SQL paziņojumus vai jautājumiem, kas ir optimizēta. 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 Nesaistītam-optimālā SQL (Strukturēts Query Language) komandas vai paziņojumus, ka pārāk garš vai garš laiks izpildīt būs izmantot daudz sistēmas resursu, izraisot 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. datu bāzi, lai vadītu lēnāka, un pēc tam arvien vairāk queries uzkrāšanos ierindošana augšu, un tad, kad savienojumu limits ir sasniegts, apmeklētāji tiek liegta vai atsaka savienojumu. In worst case scenario, your web server will go down as well, or continuously underperform. In sliktākajam scenārijam, jūsu tīmekļa servera dosies uz leju, kā arī, vai nepārtraukti underperform. 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. Šī lieta ir īpaši patiesi tad, ja jūs izmantojat MyISAM galda tipa, kas izmanto galda līmeņa bloķēšanas nevis rinda līmeņa bloķēšana augstu satiksmes mājas lapā.

Sometime, a single SQL query may be the cause of all the server's problems. Dažkārt, vienotu SQL query var izraisīt visu servera problēmas. 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 ir iebūvēts funkcionalitāti uztveršanas lēns query log vai identificētu vaicājumiem, kas nav optimāli un nepieciešams ilgs laiks, lai pabeigtu, kas ļauj jums pieteikties visi lēnas skriešanas queries kas pārņēma noteikts skaits sekundēs izpildīt ar MySQL datubāzi motors ar fails. Slow query log is not activated or on by default MySQL installation, thus it is one of the less-used logs. Lēna query log nav aktivizēts vai pēc noklusējuma MySQL uzstādīšana, tādējādi tas ir viens no mazāk izmantotajām apaļkokiem.

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: Lai aktivizētu lēno vaicājumu žurnālu, vienkārši pievieno šādu pozīcija MySQL konfigurācijas failu (my.cnf vai my.ini), un pēc tam restartējiet MySQL serveris:

log-slow-queries log-lēni queries

or vai

log-slow-queries = [path to the log file] log-lēni queries = [ceļš uz log failu]

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. Aizstāt [ceļš uz log file] ar faktisko ceļu uz lēnas query log failu vēlaties, MySQL rakstīt žurnāla, kas ir fakultatīva vērtība.

Or you can start mysqld with with the –log-slow-queries[=file_name] option to enable the slow query log. Vai arī jūs varat sākt mysqld ar ar-log-lēni queries [= FILE_NAME] opciju, lai varētu lēni query žurnālu. 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. Abos syntaxes, ja nav log faila nosaukums ir norādīts, pēc noklusējuma nosaukums ir host_name-slow.log, uzglabā ar MySQL datu failu direktoriju. If a filename is given, but not as an absolute pathname, the server writes the file in the data directory too. Ja filename ir norādīts, bet ne par absolūtu pathname, serverī raksta failu datu directory too.

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. Pēc ļaujot lēni query log, MySQL radīs, uztveršanas un žurnālu log failu ar visiem SQL apgalvojumiem, kas bija vajadzīgi vairāk nekā long_query_time sekundēs izpildīt, ko pēc noklusējuma iestatīta uz 10 sekundes. The time to acquire the initial table locks is not counted as execution time. Laika iegūt sākotnējo tabulu slēdzenes nav kā izpildes laiku. 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. mysqld raksta par to lēni query log pēc tam, kad tas ir izpildīts, un pēc tam, kad visi slēdzenes ir atbrīvotas, tā log rīkojuma starpniecību, var būt atšķirīgs no aresta rīkojumu.

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. Pēc tam jūs varat pārbaudīt visas SQL vaicājumi, ņēma ilgāk kā iepriekš noteikts skaits sekundes (10 sekundes pēc noklusējuma), kas host_name-slow.log, un pēc tam veic vajadzīgos pasākumus, lai optimizētu SQL paziņojumus. 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ēnā query log pateiks Jums par to, kas bija laikā, kad query pabeigta, cik ilgi query took darboties, cik ilgi tas aizņēma, lai nodrošinātu savu slēdzenes, cik rindas tika nosūtītas atpakaļ, kā rezultātā, cik daudz rindas tika pārbaudīti, lai noteiktu rezultātu, kas datu bāzē tika izmantota, un par faktisko query 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 jāņem vērā, ka SQL vaicājums, kas ietverti log jau varētu būt optimāla, bet izpilda lēni, ņemot vērā sistēmas resursu tika izmantoti ar faktisku lēns paziņojumu par to, ka ir jābūt smalka noregulē.

IMPORTANT : The page is machine translated and provided "as is" without warranty. SVARĪGI: Šī lapa ir mašīna tulkoto un ar nosacījumu ", kas ir" bez garantijas. Machine translation may be difficult to understand. Machine translation var būt grūti saprast. Please refer to Lūdzu, skatiet original English article oriģināls angļu rakstu whenever possible. kad vien iespējams.


4 Responses to “Enable Logging of Slow Queries (Slow Query Log) in MySQL Database” 4 Atbildes uz "Enable iegrāmatošana Lēna vaicājumu (Lēna Query Log) in MySQL Database"

  1. Robert Nolan Robert Nolan
    February 20th, 2009 21:29 Februāris 20, 2009 21:29
    4 4

    I use MONyog Query analyzer to analyze slow queries. I use MONyog Query analizatorā analizēt lēns vaicājumiem. It works flawlessly. It works flawlessly.

  2. Commander1024 Commander1024
    December 19th, 2008 19:37 Decembris 19, 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. Es nevaru tiešām apstiprina šo - Es ļāva lēns loggin pie attiecīgā config failu (Debian Lenny, mysql 5,0 latest), jo man bija "dažas" lēni queries iepriekš.
    After enabling there are thousands of “slow queries” being logged - The slow limit is set to the default of 10 sec. Pēc ļauj tūkstošiem "lēni queries" ir pieteicies - lēnā ierobežojums ir noteikts ar to, 10 sec. 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 Tas ir tiešām absurds, jo nevar būt> 10sec vaicājumam, kad visas lapas tiek aprēķināta ar php, tranferred pār tīklu un snieguši klienta pārlūkprogramma in 5 sec

    greetings Marcus greetings Marcus

  3. misrnt misrnt
    November 1st, 2008 18:48 1 novembris, 2008 18:48
    2 2

    i try to do that but this message appeared i try to darīt, bet šo ziņojumu parādījās

    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] Fatāla kļūda: Lūdzu, izlasiet "Drošība" sadaļā rokasgrāmatu, lai uzzinātu to, kā vadīt mysqld kā sakne!

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

    081101 5:34:51 [Note] mysqld: Shutdown complete 081101 5:34:51 [Piezīme] mysqld: shutdown pabeigt

    what should i do in this case? Kas man ir jādara šajā gadījumā?

  4. Change or Set MySQL Long Query Time Value for log-slow-queries » My Digital Life Maina vai Set MySQL Long Query Time Vērtība, kam log-lēni queries »Mans Digital Life
    January 23rd, 2007 00:22 Janvāris 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. [...] Ja jūs iespējojat lēni queries log no MySQL datu bāzes servera, jūs ievērosiet, ka no lēni query log fails satur tikai SQL pārskati un jautājumiem, kas prasīja vairāk nekā query_time 10 sekundes, lai veiktu vai darboties. This is the default value or query time threshold for log_slow_queries function, which is 10 seconds. Šī ir noklusējuma vērtības vai vaicājumu laika slieksni log_slow_queries funkcija, kas ir 10 sekundes. 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 sekundes ir pārāk ilgi uz SQL query, lai pabeigtu, tā vērtība var būt pārāk augstas, lai iegūtu jebkādu nozīmīgu informāciju. You can alter or change the slow query time to lower value or number of seconds. Varat mainīt vai mainīt lēns query laiku zemāko vērtību vai skaitu sekundes. 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 varat uzstādīt jaunu long_query_time ar MySQL konfigurācijas failu, proti my.cnf vai my.ini, parasti atrodas / etc direktorijā. Simply add the following line to the configuration file: [...] Vienkārši pievienot šādas līnijas līdz konfigurācijas failu: [...]

Leave a Reply Atstāj atbildi

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> Jūs varat izmantot šos tagus: <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. Parakstīties uz komentāriem iezīme ir atspējota. To receive notification of latest comments posted, subscribe to Lai saņemtu paziņojumu par jaunāko komentāri norīkots darbā, abonēt My Digital Life Comments RSS feed Mani Digital Life Comments RSS feed or vai register to receive reģistrēties, lai saņemtu new comments in daily email digest. jauni komentāri ikdienas e-pasta sagremot.
Custom Search

New Articles Jauns pants

Incoming Search Terms for the Article Incoming Meklēt Noteikumi par pants

slow query log lēns query log - -- enable slow query log ļauj lēni query log - -- mysql enable slow query log mysql varētu lēni query log - -- mysql slow query log mysql lēns query log - -- mysql slow query log my.cnf mysql lēns query log my.cnf - -- log-slow-queries log-lēni queries - -- mysql log slow queries my.cnf mysql log lēns queries my.cnf - -- mysql slow query log enable mysql lēns query log ļautu - -- log slow queries log lēns queries - -- mysql log slow queries mysql log lēns queries - -- mysql slow query mysql lēns query - -- enable the slow query log ļauj lēni query log - -- slow query log my.cnf lēns query log my.cnf - -- enable mysql slow query log ļautu mysql lēns query log - -- log slow queries mysql log lēns queries mysql - -- mysql turn on slow query log mysql ieslēgtu lēns query log - -- my.cnf slow query log my.cnf lēns query log - -- log slow queries my.cnf log lēns queries my.cnf - -- my.ini log my.ini log - -- MYSQL LOG queries MySQL APAĻKOKU queries - -- how to enable slow query log kā veicināt lēns query log - -- enable mysql log ļautu mysql log - -- log-slow-queries my.cnf log-lēni queries my.cnf - -- my.cnf slow query my.cnf lēns query - -- enable slow query log mysql ļauj lēni query log mysql - -- log slow query log lēns query - -- slow query logging lēns query mežizstrāde - -- mysql enable slow query mysql varētu lēni query - -- my.ini slow query log my.ini lēns query log - -- log-slow-queries my.ini log-lēni queries my.ini - -- MySQL Query Log MySQL Query Log - -- my.cnf slow log my.cnf lēns log - -- enable slow query ļauj lēni query - -- mysql enable slow queries mysql varētu lēni queries - -- mysql log-slow-queries my.cnf mysql log-lēni queries my.cnf - -- enable slow queries ļauj lēni queries - -- slow query log Mysql lēns query log mysql - -- my.cnf slow queries my.cnf lēns queries - -- Enable the slow query log Enable lēnā query log - -- mysql log long queries mysql log ilgi queries - -- mysql slow query enable mysql lēns query ļautu - -- my.cnf query log my.cnf query log - -- turn on slow query log mysql ieslēgtu lēno query log mysql - -- turn on slow query log ieslēgtu lēno query log - -- mysql log-slow-queries mysql log-lēni queries - -- mysql slow queries log mysql lēns queries log - -- mysql slow query log location mysql lēns query log atrašanās vieta - -- mysql slow query log configuration mysql lēns query log konfigurācija - -- slow queries my.cnf lēns queries my.cnf - -- enable mysql slow queries ļautu mysql lēns queries - -- mysql Turn on slow query logging mysql Ieslēgt lēns query mežizstrāde - -- mysql log slow query mysql log lēns query - -- mysql enable slow query log my.cnf mysql varētu lēni query log my.cnf - -- enabling slow query log ļaujot lēni query log - -- turn on mysql slow query log ieslēgtu mysql lēns query log - -- enable mysql logging ļautu mysql mežizstrāde - -- my.ini log-slow-queries my.ini log-lēni queries - -- mysql enable logging mysql varētu mežizstrāde - -- enable mysql logs ļautu mysql baļķi - -- my.ini logging my.ini mežizstrāde - -- 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 to, kā slowquery žurnālā windos izmantojot my.cnf vai my.ini ar mysql 4,1 - -- my.cnf log queries my.cnf log queries - -- mysql enable log slow queries mysql varētu log lēns queries - -- mysql slow log mysql lēns log - -- mysql log level mysql log līmenis - -- mysql log query mysql log query - -- how to enable slow query in mysql kā veicināt lēns query in mysql - -- my.cnf log-slow-queries my.cnf log-lēni queries - -- mysql long query time mysql ilgi query laiks - -- Enabling slow query log in mysql Iespējojot lēns query žurnālā mysql - -- my.cnf log my.cnf log - -- mysql enable slow log mysql varētu lēni log - -- slow log my.cnf lēns log my.cnf - -- how to enable slow query log in mysql kā veicināt lēns query žurnālā mysql - --