Caching authorization IDs for plans

Authorization checking is fastest when the plan is reused by an ID or role that already appears in the cache and when the EXECUTE privilege is granted to PUBLIC.

About this task

Start of changeYou can set the size of the plan authorization cache by using the CACHESIZE option on the BIND PLAN subcommand. The default value for cache size is 4K. Db2 uses this cache for caching the authorization IDs of those users that are running a plan. Db2 uses the CACHESIZE value to determine the amount of storage to acquire for the authorization cache. Db2 acquires storage from the EDM storage pool.End of change

Start of changeThe size of the cache that you specify depends on the number of individual authorization IDs that are actively using the plan. The plan authorization cache includes 32 bytes of overhead information. In addition, each entry in the plan authorization cache is initially set to 12 bytes. If a role entry that is to be cached is greater than 8 bytes, Db2 increases the size of each entry for that plan in 20-byte increments up to 128 bytes.End of change

Start of changeIf you run the plan infrequently, or if authority to run the plan is granted to PUBLIC when you are using Db2 native authorization controls, you might want to turn off caching for the plan so that Db2 does not use unnecessary storage. To do this, specify a value of 0 for the CACHESIZE option.End of change

Any plan that you run repeatedly is a good candidate for tuning by modifying the plan authorization cache size. Also, if you have a plan that a large number of users run concurrently, you might want to use a larger plan authorization cache size.