Enable Logging of Slow Queries (Slow Query Log) in MySQL Database Ativar registro de Consultas Lento (Slow Query Log) no MySQL Database

One of the main requirements for a fast Um dos principais requisitos para um rápido web server servidor web is to has efficient and effective SQL statements or queries that are optimized. é a eficaz e eficiente, tem instruções SQL ou consultas que são otimizadas. 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 Qualquer não-ideal SQL (Structured Query Language) comandos ou declarações que ter demorado demasiado tempo ou tempo suficiente para executar irá utilizar-se um lote de sistema de recursos, causando 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. banco de dados para executar mais lento e, em seguida, mais e mais consultas atrasos filas para cima, e quando a ligação limite é alcançado, os visitantes têm sido negada ou recusada conexão. In worst case scenario, your web server will go down as well, or continuously underperform. No pior cenário, o servidor web vão ficar tão bem, ou do que continuamente. 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. O caso é especialmente verdadeiro quando você estiver usando o tipo de tabela MyISAM que usa tabela de nível de bloqueio em vez de linha de nível de bloqueio em um site de alto tráfego.

Sometime, a single SQL query may be the cause of all the server’s problems. Às vezes, uma única consulta SQL pode ser a causa de todos os problemas do servidor. 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 vem com funcionalidade para capturar lento query log ou identificar as consultas que não são os ideais e levar muito tempo para terminar, o que lhe permite registrar todas as consultas executando lento que retomou definido número de segundos para executar a motor a um banco de dados MySQL. arquivo. Slow query log is not activated or on by default MySQL installation, thus it is one of the less-used logs. Slow query log não está ativado por padrão ou a instalação MySQL, assim, é uma das menos usadas logs.

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: Para ativar a lentidão consulta rápida, basta adicionar a seguinte linha ao MySQL arquivo de configuração (my.cnf ou my.ini) e, em seguida, reinicie o servidor MySQL:

log-slow-queries

or ou

log-slow-queries = [path to the log file] log-slow-queries = [caminho para o arquivo de log]

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. Substitua [caminho para o arquivo de log] com o caminho real para a lenta query log arquivo que você deseja que o MySQL a escrever para o log, que é o valor opcional.

Or you can start mysqld with with the –log-slow-queries[=file_name] option to enable the slow query log. Ou você pode iniciar mysqld com a com-log-slow-queries [= file_name] opção para permitir que a lentidão consulta rápida. 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. Em ambas as sintaxes, se não for O nome do arquivo de log é especificado, o nome padrão é host_name-slow.log, armazenados no ficheiro de dados MySQL diretório. If a filename is given, but not as an absolute pathname, the server writes the file in the data directory too. Se um nome de arquivo for dado, mas não como um caminho absoluto, o servidor grava o arquivo no diretório de dados também.

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. Após ativar lento query log, MySQL irá criar, captura e registro para o arquivo de log com todos os comandos SQL que teve mais de long_query_time segundos para executar, que é por padrão definido para 10 segundos. The time to acquire the initial table locks is not counted as execution time. O prazo inicial para a aquisição das eclusas tabela não é contado como tempo execução. 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 escreve uma declaração para a lenta query log depois de ter sido executado, e após todos os bloqueios foram liberados, de forma rápida ordem poderia ser diferente de execução judicial.

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. Você pode então examinar todas as consultas SQL que levou mais tempo do que o pré-determinado número de segundos (10 segundos por padrão) no host_name-slow.log e, em seguida, tomar as medidas necessárias para otimizar os comandos SQL. 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. A lentidão query log irá dizer-lhe sobre o que foi concluída a consulta tempo, por quanto tempo a consulta levou para executar, quanto tempo levou para garantir a sua fechaduras, quantas linhas foram enviados de volta, como resultado, quantas linhas foram examinados para determinar o resultado, qual banco de dados foi usado, e os reais consulta em si. 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. Mas tenha em mente que uma consulta SQL contidas no log já pode ter ótimas, mas executado lentamente devido a recursos do sistema foi utilizado até pelo próprio lenta afirmação de que precisam de ser adaptadas.

IMPORTANT : This is a machine translated page which is provided "as is" without warranty. IMPORTANTE: Esta é uma página traduzida máquina que é fornecida "como está" sem garantia. Machine translation may be difficult to understand. A tradução automática pode ser difícil de compreender. Please refer to Por favor, consulte a original English article Inglês original article whenever possible. sempre que possível.

Share and contribute or get technical support and help at Compartilhe e contribuir ou obter suporte técnico e ajudar a My Digital Life Forums Minha vida digital Fóruns .



One Response to “Enable Logging of Slow Queries (Slow Query Log) in MySQL Database” Uma resposta a "Ativar registro de Consultas Lento (Slow Query Log) no MySQL Database"

  1. Change or Set MySQL Long Query Time Value for log-slow-queries » My Digital Life Alterar ou definir o MySQL Query Long Time Valor para log-slow-queries "Minha vida digital
    January 23rd, 2007 00:22 23 de janeiro de 2007 00:22
    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. [...] Se você ativar log de consultas lentas banco de dados MySQL, você vai notar que a partir do lento query log arquivo contém apenas instruções SQL e de consultas que teve mais de query_time de 10 segundos para executar ou correr. This is the default value or query time threshold for log_slow_queries function, which is 10 seconds. Este é o valor padrão ou pesquisa log_slow_queries tempo limite para a função, que é 10 segundos. 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 segundos é muito longo caminho para uma consulta SQL para completar, de modo que o valor pode ser demasiado elevado para capturar qualquer significado dos dados. You can alter or change the slow query time to lower value or number of seconds. Você pode modificar ou alterar o tempo de consulta lenta valor mais baixo ou o número de segundos. You can set a new long_query_time in the MySQL configuration file, namely my.cnf or my.ini, normally located in /etc directory. Você pode definir um novo long_query_time o MySQL no arquivo de configuração, ou seja, my.cnf ou my.ini, normalmente localizados no diretório / etc. Simply add the following line to the configuration file: [...] Basta adicionar a seguinte linha no arquivo de configuração: [...]

Leave a Reply Deixe uma resposta

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> Você pode usar estas tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime = ""> <em> <i> <q Cite=""> <strike> <strong>

Subscribe without commenting Subscreva sem comentar


Custom Search

New Articles Novos Artigos

Incoming Search Terms for the Article Incoming Termos de pesquisa para o artigo

enable slow query log permitir lento query log - -- mysql enable Slow Query Log MySQL permitir Slow Query Log - -- slow query log lento query log - -- slow query log my.cnf lento query log my.cnf - -- my.cnf slow log my.cnf lento log - -- log slow queries log queries lentas - -- mysql long queries MySQL longo queries - -- mysql slow query log MySQL lento query log - -- my.ini slow query log my.ini lento query log - -- enable mysql log permitir que o MySQL log - -- slow query my.cnf lento consulta my.cnf - -- mysql enable slow query logging MySQL permitir lento query log - -- mysql enable query log MySQL permitir query log - -- mysql turn on slow query log mysql transformar a lentidão query log - -- Enable slow query Ativar consulta lenta - -- mysql enable slow query log my.cnf mysql permitir lento query log my.cnf - -- my.cnf slow query my.cnf lento query - -- mysql log slow queries my.cnf MySQL log queries lentas my.cnf - -- mysql slow query log my.cnf MySQL lento query log my.cnf - -- how to enable slow query log como ativar lento query log - -- mysql long query MySQL longo query - -- log-slow-queries log-slow-queries - -- mysql enable log MySQL permitir log - -- log slow query query log lento - -- mysql query log MySQL query log - -- enable mysql query logging permitir que o MySQL query log - -- mysql log sql queries MySQL log consultas SQL - -- log all mysql queries that slow down mysql registrar todas as consultas que abrandar - -- mysql enable logs MySQL permitir logs - -- mysql turn on slow log MySQL transformar a lentidão log - -- log-slow-queries my.ini log-slow-queries my.ini - -- mysql slow query MySQL query lento - -- mysql detect slow queries O MySQL detecta consultas lentas - -- mysql log slow queries MySQL log queries lentas - -- Enable the slow query log Ativar o lento query log - -- enable mysql logging permitir que o MySQL madeireira - -- mysql query log my.ini MySQL query log my.ini - -- mysql logging turn on MySQL transformar a exploração madeireira - -- mysql long query log MySQL longo query log - -- slow query log mysql my.cnf lento query log MySQL my.cnf - -- my.ini long query time my.ini longo tempo query - -- MySQL slow queries my.ini MySQL queries lentas my.ini - -- my.cnf query log my.cnf query log - -- enable slow query in mysql permitir lento consulta no MySQL - -- Query taking more than the threshold time, execution time = 92 secs. Consulta tendo a mais do que o tempo limite, a execução hora = 92 segs. - -- log-slow-queries my.cnf log-slow-queries my.cnf - -- mysql log slow queries my.ini MySQL log queries lentas my.ini - -- mysql slow query log location MySQL lento query log local - -- turn on slow query log vire a lentidão query log - -- enable mysql query log permitir que o MySQL query log - --