SET LOG question
Posted in 2001
Topics: General Discussion
Hi all. Let's say I have a database with Buffered Logging. I open a session and do a SET LOG; that redefines the logging mode to unbuffered for this session only ( yes ? no ?) How can I retrieve the logging mode of the session ? Does the server write imediatelly the transactions to disk only for that session, or for all sessions ? Thanks, Bogdan Neagu
Bogdan Neagu wrote: > > Hi all. > > Let's say I have a database with Buffered Logging. > > I open a session and do a SET LOG; that redefines the logging mode to > unbuffered for this session only ( yes ? no ?) Yes. > How can I retrieve the logging mode of the session ? > > Does the server write imediatelly the transactions to disk only for that > session, or for all sessions ? Well..... If ANY database is Unbuffered Log Mode and a transaction against a table in THAT database commits then the current (of 3) logical log buffers is immediately flushed to disk even if it is not full. That may take with it transaction data from other, Buffered Log Mode, databases so that for that period of time they will act as if they are indeed unbuffered, yes. But ONLY while there are active transactions completing on the unbuffered database. Art S. Kagel > Thanks, > > Bogdan Neagu
Art S. Kagel wrote in message <3A5E291C.A9FCC7A7@bloomberg.net>... > >> Does the server write imediatelly the transactions to disk only for that >> session, or for all sessions ? > >Well..... If ANY database is Unbuffered Log Mode and a transaction against >a table in THAT database commits then the current (of 3) logical log >buffers is immediately flushed to disk even if it is not full. That may >take with it transaction data from other, Buffered Log Mode, databases so >that for that period of time they will act as if they are indeed unbuffered, >yes. But ONLY while there are active transactions completing on the >unbuffered database. > Yup - specifically: 1) The logical log buffer is written to by all transactions. 2) Whenever there is a demand for a logical log buffer to be flushed, the engine schedules the writing of that buffer. 3) If any process is waiting for a guarantee for the buffer to be flushed, they are put on a wait queue, pending that buffer write. 4) If any other process writes log information to the log buffer before the scheduled write is performed, then so be it... this is called "piggy-backing" log records. 5) Once the buffer is flushed, all waiting processes are woken up - these are at least the processes running with unbuffered logging (which I understand also includes all transactions in an ANSI database) Point 4 is one of the saviours of unbuffered databases on a busy system. Even if a particular commit triggers a log buffer write, if the system is "sufficiently busy" then the logical log buffer will tend towards being fairly full regardless of the unbuffered mode. There are statistics you could look at to check the fullness of the writes, and see what the space efficiency of your log buffers is. You also asked how you can tell what logging mode a particular process is in... hmmm - can't see anything. Sorry.