Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Can anybody give an example or scenario of log sequence number(LSN) used in MySQL

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

From mysqlperformanceblog

Log Sequence Number (LSN) : Log Sequence Numbers correspond to given position in the log files and typically incremented for each log record. Innodb uses number of bytes ever written to the log files however it could be something different. LSNs are often extensively used in recovery check pointing and buffer management operations. When checkpoint (both fuzzy and not) happens you get something like “all changes up to LSN=X are now flushed to the data space” this means you can discard or archive logs for LSN earlier than that. When doing log recovery checking LSN in the log record can tell if you this change needs to be applied or it already was applied (when doing recovery you do not know which dirty pages were flushed from the buffer pool).

The LSN do not relate much to transactions – changes from different transactions are intermixed in the log files and many LSNs can correspond to changes from the same transaction.

For other references please have a look at

1 How to know the current log sequence number in 5.0.X.

2 How to check if Innodb log files are big enough

share|improve this answer
    
why LSN values is greater than 'Innodb_os_log_written' ? –  shiva Jul 4 '13 at 14:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.