Pre-allocating space for database files

When you create a new database file, you can pre-allocate database space using the DATABASE SIZE clause of the CREATE DATABASE statement or by specifying the dbinit -dbs option. See CREATE DATABASE statement, and Initialization utility (dbinit).

As you use the database, SQL Anywhere automatically grows database files as needed. Rapidly-changing database files can lead to excessive file fragmentation on the disk, resulting in potential performance problems. As well, many small allocations are slower than one large allocation. If you are working with a database with a high rate of change, you can pre-allocate disk space for dbspaces or for transaction logs using either Sybase Central or the ALTER DBSPACE statement.

You must have DBA authority to alter the properties of a database file.

Performance tip

Running a disk defragmentation utility after pre-allocating disk space helps ensure that the database file is not fragmented over many disjointed areas of the disk drive. Performance can suffer if there is excessive fragmentation of database files.

To pre-allocate space (Sybase Central)

  1. Open the Dbspaces folder.

  2. Right-click the dbspace and choose Pre-allocate Space.

  3. Enter the amount of space to add to the dbspace. You can add space in units of pages, bytes, kilobytes (KB), megabytes (MB), gigabytes (GB), or terabytes (TB).

  4. Click OK.

To pre-allocate space (SQL)

  1. Connect to a database.

  2. Execute an ALTER DBSPACE statement.

Examples

Increase the size of the system dbspace by 200 pages.

ALTER DBSPACE system
ADD 200;

Increase the size of the system dbspace by 400 megabytes.

ALTER DBSPACE system
ADD 400 MB;
See also