The Story of Max Database Size (Connection String Parameter)


Maximum Database Size is NOT a persistent configuration (It is NOT stored in database file).  SQL CE creates shared memory to support multi-connection scenarios.  SQL CE maintains an entry for each page of the database file, in this shared memory.  Because we don't always grow to 4 GB, it is not wise to allocate shared memory to accommodate all page entries/references to support 4 GB.  This means, we should have a default for max no. of page references (max database size) in shared memory to be reserved.

Maximum Database Size is defaulted to 128 MB on devices and 256 MB on desktops (for v3.1). 

But sometimes user knows that it may grow beyond the default Maximum Database Size and hence should be provided with a configuration parameter in connection string.  As you can see this connection string parameter Max Database Size is helpful only for the connection that is creating the shared memory and reserving the page reference part; which is obviously the first connection to database.  (Note: For every database file, there exists only one shared memory).  The 2nd connection cannot do anything with this connection string parameter as there is exists a shared memory for that database, 2nd connection has to just rely upon the existing configuration.  The moment all connections are down, the shared memory is deleted.  That is why you can reconfigure the Max Database Size for every first connection to the database file.

The story holds good for other connection string parameters like ‘Max Buffer Size’.



Laxmi Narsimha Rao ORUGANTI

Comments (1)

  1. If you are using the Visual Studio 2008 DB Pro GDR CTP (that’s a mouthful) you may run into a schema

Skip to main content