Size of Logical Logfiles
Posted in 1999
Topics: Logging & Checkpoints
Hi *, I´d like to know whats the best size for Logical Logfiles. I´m using an unbuffered Log with my Database. So what happens when a tansaction commits? Is the whole Logfile written to disk? Or is just the part written to disk which has changed? Thanks Thomas
When a transaction commits, nothing happens to the logical logs. When a transaction rolls back, the content of the logical logs from the last 'begin work' is copied back to the database. Your logical logs should be large enough to hold all the pages that will be modified by your largest transaction, and then some. -- Bashar Chalabi CTL, London Thomas Mieslinger <thomas.mieslinger@germanparcel.de> wrote in message news:37CBF072.D302724@germanparcel.de... > Hi *, > > I'd like to know whats the best size for Logical Logfiles. I'm using an > unbuffered Log with my Database. So what happens when a tansaction > commits? Is the whole Logfile written to disk? Or is just the part > written to disk which has changed? > > Thanks > > Thomas
OK, unbuffered logging means that all logical log records are still written to the current of three logical log buffers, however, unlike for buffered logging, that buffer (its full size even if only partially full) is flushed to disk when ANY commit record for a transaction affecting an unbuffered database table is written to the buffer. In buffered logging the buffer flush is deferred until the buffer is completely filled. This becomes confused if you have multiple databases with different logging modes but is basically true. Unbuffered logging takes up more space in the log files on disk faster that buffered logging since a partial buffer will be flushed in its entirety. As to the initial question: What's the best size for logical log files? Well that is a debated issue. Smaller logfiles will be backed up more often than larger logfiles if you are using continuous log backup or are using the alarm program to backup the logs as they fill. Therefore smaller logfiles are safer. However, to provide a fixed amount of total log file space you will consequently need more logfiles and more logfiles means more DBA maintenance and more headache. Also one could argue that if the typical transaction is larger than a single logfile there is little actual gain from the faster archiving of the logs since if the next log, on disk, is not yet backed up when the system crashes and archived logs have to be used, then the last N transactions will be rolled back anyway so nothing was gained by archiving the smaller logs sooner. So the competing and contradictory rules of thumb are: o More smaller logs are safer o Fewer larger logs are easier to manage o Configure the log file size to be at least as large as a typical transaction (in log records not data pages) o Configure the log file size to be about 1/2 the typical transaction o Configure the log file size to be about 1/2 the largest expected transaction There is a discussion in the System Administrators Guide about sizing the logfiles and I believe that the subject is covered in several of the Informix DBA books available. Art S. Kagel Thomas Mieslinger wrote: > > Hi *, > > I´d like to know whats the best size for Logical Logfiles. I´m using an > unbuffered Log with my Database. So what happens when a tansaction > commits? Is the whole Logfile written to disk? Or is just the part > written to disk which has changed? > > Thanks > > Thomas