Monday, July 9, 2012

MYSQL LOGS


BINARY LOG
The Binary Log- The binary log contains “events” that describe the database changes such as table creation operations or changes to table data.It also contains events for statements that potentially could have made changes. The binary log has two important purposesFor replication, the binary log is used on master replication servers as a record of the statements to be sent to slaves,which execute those events to make the same data changes that were made on the masterCertain data recovery operations require use of the binary log. After a back-up has been restored, the events in binary log that were recordedafter the back-up was made are re-executed. These events bring databases up to date from the point of the back-up.

SLOW QUERY LOG
Slow Query Log- The slow query log consist of sql statements that took more than long query time seconds to execute.The minimum and default values of long query time are 1 and 10, respectively.The time to acquire the initial table looks is not counted as execution time.Mysqld writes the statement to the slow query log after it has been executed and after all locks have been released,so log order might differ from execution order.

ERROR LOG
The error log- the error log contains information indicating when mysqld was started and stopped and also any critical errors that occur while the server is running. If mysqld notices a table that needs to be automatically checked or repaired , it writes the message to the error log.On some operating systems, error log, contains a stack trace if mysqld dies. The trace can be used to determine where mysqld died.

GENERAL QUERY LOG
The general query log- is the general record of what mysqld doing. The server writes the information to this log when clients connector disconnect, and it logs each SQl statement received from clients. The general query log can be very useful when you suspect an errorin a client and want to know exactly what the client sent to mysqld.Mysqld write statements to the query log, in the order that it receives them, which might differ from the order in which they are executed.This logging order contrasts to the binary log, for which statements are written after they are executed but before any locks are released.

No comments:

Post a Comment