db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <Knut.Hat...@Sun.COM>
Subject Re: The size of caches for dataDictionary
Date Wed, 21 Feb 2007 07:20:52 GMT
Stanley Bradbury <Stan.Bradbury@gmail.com> writes:

> Yifan wrote:
>>
>> I have looked into the code for data dictionary. In the source code,
>> there are some caches for tables or columns.
>>
>> One thing I am a little confused is the size of these caches.
>>
>> For example, if there is no DDL statement but only DML statement
>> which manipulate on all tables, will the table cache keep all tables
>> in memory or just part of them?
>>
>> If we do not have enough memory, will table belong to further DML
>> statement being cached or not?
>>
>>  
>>
>> Thanks
>>
>> Yifan
>>
> The setting of pageCacheSize determines the number of pages that will
> be held in the data cache.  New pages needed to satisfy the DML
> executed will be added to the cache until the pageCacheSize limit is
> reached.  At this point the LRU pages in the cache will be removed to
> make room for newly referenced pages. 
>
> Theoretically, if the pageCacheSize is larger than the size of all the
> tables and indexes in the database , all the the tables could become
> loaded into the cache and remain there until Derby is shutdown.

I'll just add that the table cache Yifan observed in the data
dictionary (which is not the same as the page cache) only contains
metadata describing the tables. So even when that cache contains
information about all the tables, it should consume just a small
amount of memory compared to the total storage space required by the
tables. By default, the table cache contains at most 64 table
descriptors. The table cache uses the same LRU-like algorithm as the
page cache to keep the most recently referenced table descriptors in
memory.

-- 
Knut Anders

Mime
View raw message