IBM Support

On what basis DB2 evicts the plans from package cache ?

Technical Blog Post


On what basis DB2 evicts the plans from package cache ?


The actual cleanup logic looks at a bunch of things in order, for example, invalid entries, empty entries that got left behind, and eventually evict entries based on least recently used order. The package cache daemon would try to do cleanup if the package cache is at least 90% full. Fixing the package cache size does not affect how the package cache daemon behaves (e.g. how it chooses when and what to cleanup). When PCKCACHESZ is set to AUTOMATIC to be tuned by STMM, there's logic that looks at how many times the package cache has been overflowed and other stats to determine if more memory needs to be allocated to the package cache from other memory pools.

As a general rule, as new statements get executed, the package cache will get filled up and old entries will age and get evicted as there's only limited amount of space.

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSEPGG","label":"DB2 for Linux- UNIX and Windows"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"","Edition":""}]