Skip to Main Content
Spotfire Ideas Portal
Status Planning to implement
Categories caching
Created by Guest
Created on Sep 23, 2022

Truncate cache buckets instead of delete

Currently buckets have all their records deleted, and then the new records are inserted. In the database this means 2 write operations, and is a major cause of index fragmentation.

Most databases allow you to truncate the table, which is only an administrative marker, and is nearly instantaneous.

Thus please use "Truncate table" to both double the speed of caching on the cache database, and to reduce index fragmentation, leading to better performance of the cache.

  • Attach files
  • Guest
    Nov 13, 2023

    While I generally agree to use TRUNCATE instead of an unqualified DELETE, there are some caveats to using TRUNCATE especially while other sessions are going on in parallel.

    See for example the Notes in the PostgreSQL manual (https://www.postgresql.org/docs/current/sql-truncate.html).