Preallocating space for database files

When you create a new database file, you can preallocate 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 preallocate disk space for dbspaces or for transaction logs using either Sybase Central or the ALTER DBSPACE statement. See ALTER DBSPACE statement.

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

Performance tip

Running a disk defragmentation utility after preallocating 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 preallocate space (Sybase Central)
  1. Use the SQL Anywhere 12 plug-in to connect to the database as a user with DBA authority.

  2. Open the Dbspaces folder.

  3. Right-click the dbspace and choose Preallocate Space.

  4. 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).

  5. Click OK.

 To preallocate space (SQL)
  1. Connect to a database.

  2. Execute an ALTER DBSPACE statement.

 Examples
 See also