Log In    |    Knowledge Base    |    4D Home
Tech Tip: Flush vs Purge
Published On: January 6, 2012

Since changes have been made to the cache in 4D v11 SQL and 4D v12, it is important to be familiar with the difference between a flush and a purge.

  • Flush
    This is the act of writing database changes to disk. Changes made to things like records and indexes are done in the cache. A cache flush will write these changes to the disk. Flushing will occur when executing the FLUSH BUFFERS command or based on the value specified in the "Flush Data Buffers every X Minutes" database setting.

  • Purge
    This is where items are removed from the cache. There are actually 2 kinds of purges:

    • Partial
      A partial purge is when items are removed from the cache in order to make room for new items that need to be placed in the cache. When this happens, the cache is emptied in the amount of 25% of the total cache size. What happens is that if a new object is larger than the amount of empty space in the cache, then 4D will empty 25% of the cache. If at this point the new object is still larger than the amount of empty space in the cache, then 4D will empty another 25% of the cache. This process will continue until there is enough empty space in the cache for the new object.

    • Full
      This is where the cache is completely emptied. After a full purge, the used cache is 0 (or near 0). A full purge is performed by using the command FLUSH BUFFERS with the * parameter. Note that a full purge is typically only usefull for troubleshooting purposes.

See Also: