KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Database Performance and Flushing Buffers
PRODUCT: 4D | VERSION: 11 | PLATFORM: Mac & Win
Published On: July 1, 2009

4D uses a built in data cache scheme for accelerating I/O operations: Data buffers are stored in memory and then flushed to disk at a regular interval. This can be set via a database's Prefences via the Preferences>Database>Data Management page. The "Flush Data Buffers Every: X Minutes" setting allows you to set the "X" value and control how often 4D flushes the data buffers. The FLUSH BUFFERS command can also be called to force the buffers to be flushed to disk.

It is important to note that there is overhead when flushing the data buffers. Each time you save a new record, the database's address table is updated. So if you were to create ten new records, and if you were to flush the buffers for each of the occurances, the same address table would be saved on disk ten times. If instead you were to flush once at the end the address table would be saved on disk only once, avoiding 90% of the disk I/O.

Be careful when setting your Data Buffer time in preferences and calling FLUSH BUFFERS as using time periods that are very short can cause a performance hit.

Commented by Atanas Atanassov on July 23, 2009 at 11:36 AM
It should be up to developer to find out which is importand for certain cases , performance or data security. They may want to record some valuable information immediately on the disk instead keeping it into the memory.