Index
  Release notes
  solidDB for MySQL
  GPL v2

solidDB for MySQL 5.0
Solid Information Technology, Ltd.
Copyright © Solid Information Technology Ltd 1993-2006. All rights reserved.
This documentation is not distributed under a GPL license.
This documentation is for the solidmysql-5.0.27-0064 release.

1. solidDB for MySQL 5.0 User Guide


1.1. solidDB for MySQL Overview

solidDB for MySQL is a turbo-charged version of MySQL database that leverages solidDB Storage Engine to support heavy transaction volumes and large numbers of concurrent users. It is a complete relational database management system (RDBMS) that combines MySQL Server, solidDB Storage Engine and MyISAM storage engine.

solidDB for MySQL is based on Solid's proven transactional product Solid EmbeddedEngine™, which is a fully-featured relational database that is being used in products from companies including HP, Siemens, Nortel and NEC. solidDB for MySQL will supports mission critical applications that require a high level of reliability and large transaction volumes. solidDB for MySQL is licensed under GNU GPL.

solidDB Storage Engine for MySQL leverages solidDB Storage Engine, which is a multi-threaded, transactional storage engine for MySQL Server. It is designed for mission-critical implementations that require a robust, transactional database able to fully leverage multi-processor environments to support heavy transaction volumes and a large number of concurrent users. solidDB Storage Engine for MySQL supports full ACID compliance with configurable transaction isolation levels, both optimistic and pessimistic concurrency control, Multi-Version Concurrency Control (MVCC) with non-blocking reads and writes, row-level locking, and support for foreign keys and referential integrity.

1.2. Solid Contact Information

Contact information for Solid:

Web site: http://www.solidtech.com

Sales inquiries:

Technical support:

Marketing:

Offices

  • Americas

  • Asia Pacific

  • EMEA

Americas

Solid World Headquarters
    20400 Stevens Creek Blvd, Suite 200
    Cupertino
    CA
    95014
    USA
    +1 408 4544700
    +1 408 4544900

Asia Pacific

Solid APAC Headquarters
    Solid K.K.
    43rd Floor
    The Landmark Tower Yokohama
    2-2-1 Minatomirai, Nishi-ku
    Yokohama
    220-8143
    Japan
    +81 45 2242525
    +81 45 2242535

EMEA

 Solid EMEA Headquarters
    Italahdenkatu 22 B
    FIN-00210
    Helsinki
    Finland
    +358 42488881
    +358 9 2782877

1.3. Installing solidDB for MySQL

This chapter covers solidDB for MySQL installation for both the Windows and Linux platforms.

1.3.1. Installing solidDB for MySQL on a Windows Platform

solidDB for MySQL is delivered as a .zip package without a Windows Installer. To install, unzip the package to a directory of your choice. To start the server, either double click the mysqld.exe in the bin folder or start it from the command line as shown here:

C:> cd <WHERE-YOU-INSTALLED>

C:> bin\mysqld

Use your favorite SQL tool to connect to the database. You can also use mysql.exe and mysqladmin.exe in the bin folder, but these applications must be run from the command line.

1.3.2. Installing solidDB for MySQL on a Linux Platform

solidDB for MySQL is delivered as a tar.gz package. Extract the package under a non-root user's home directory or to a directory of your choice. The commands are:

shell> tar zxvf solidmysql-5.0.27-linux-i686-VERSION.tar.gz

shell> cd solidmysql-5.0.27-linux-i686-VERSION

shell> bin/mysqld_safe --default-storage-engine=solidDB &

You can create a solidDB database (solid.db) in the data/ directory as shown here:

shell> cd bin

shell> ./mysql -u root

shell> create database solid;

shell> use solid;

Note

If you want to run mysqld as root, you must supply --user=<username> to mysql_install_db and mysqld_safe. In this case, the server is started as that user's process. If you are root and try to do this without the --user option, the server will fail to start.

1.4. Compiling from Source Distribution

This chapter explains how to compile solidDB for MySQL from source for both the Windows and Linux platforms.

1.4.1. Source Compilation in Windows

The basic steps that you must execute to install a solidDB for MySQL source distribution in Windows are:

  1. You must have the Visual C++ .NET 2003 compiler installed.

  2. Unzip the source distribution.

  3. Start Microsoft Visual Studio.

  4. Open a solution mysql through File/Open solution... from the MySQL root directory.

  5. Click the Solution explorer at the upper left corner. At the bottom, you can see the Active config field. You can use this field to choose between Release and Debug.

  6. In the Solution explorer window, find mysqld and right click it. Choose the build that rebuilds the mysqld executable.

  7. The new mysqld executable will be stored in the client_release directory with name mysqld.exe (Release) or client_debug directory with name mysqld-debug.exe (Debug).

  8. You can use the executables in the same way as in Linux. To see output on the command prompt screen, start the executables with the --console option.

1.4.2. Source Compilation in Linux

The commands that you must give to install a solidDB for MySQL source distribution in Linux are:

shell> groupadd mysql

shell> useradd -g mysql mysql

shell> gunzip < solidmysql-VERSION.tar.gz | tar -xvf -

shell> cd solidmysql-VERSION

shell> ./BUILD/compile-pentium-soliddb --prefix=/usr/local/mysql

shell> make install

shell> cp support-files/my-medium.cnf /etc/my.cnf

shell> cd /usr/local/mysql

shell> bin/mysql_install_db --user=mysql --no-defaults --datadir=/usr/local/mysql/var

shell> chown -R root .

shell> chown -R mysql var

shell> chgrp -R mysql .

shell> cp support-files/my-soliddb.cnf /etc/my.cnf

1.5. solidDB for MySQL Configuration

The solidDB Storage Engine for MySQL is enabled by default. If you do not want to use solidDB tables, you can add the skip-soliddb option to your MySQL option file.

This section contains representative examples of solidDB configuration parameters. Refer to Section 1.7, "solidDB for MySQL Startup Options and System Variables" for additional information about solidDB-related configuration parameters.

To set up the solidDB database files, use the soliddb_filespec option in the [mysqld] section of the my.cnf option file. On Windows, you can use the my.ini file instead. The value of soliddb_filespec should be a list of one or more database file specifications. If you name more than one data file, separate them by comma (",") characters:

soliddb_filespec=database_file[,database_file2]...

For example,

[mysqld]
soliddb_filespec=soliddb1 10M
    

This setting configures a single 10MB database file named soliddb1. No location for the database file is given. By default, solidDB creates it in the MySQL data directory. The full syntax for a database file specification includes the filename and the file-size:

file_name file_size

solidDB creates tablespace files in the MySQL data directory by default. To specify a location explicitly, use the soliddb_filespec option with a path. For example, to use two files named soliddb1 and soliddb2 but create them in the /soliddb directory, configure solidDB like this:

[mysqld]
soliddb_filespec=/soliddb/soliddb1 10M,/soliddb/soliddb2 20M
  

For more information on file management, see Section 1.26, "solidDB File Space Management and Disk I/O".

If you want to tune other mysqld and solidDB parameters, the following values are typical and would suit most users:

[mysqld]
 skip-external-locking
 max_connections=1024
 read_buffer_size=1M
 sort_buffer_size=1M
 #
 # Set key_buffer to 5 - 50% of your RAM depending on how much
 # you use MyISAM tables, but keep key_buffer_size + solidDB
 # cache size < 80% of your RAM
 key_buffer_size=value
 #
 # Set the cache size to 70-80% of your ram
 #
 #
 soliddb_cache_size=value
 #
 # Set durability to strict
 #
 set-variable = soliddb_durability_level=3
 character-set-server=latin1
 collation-server=latin1_general_cs
 
 [client]
 default-character-set=latin1

1.6. Starting the Server and Activating solidDB for MySQL

This chapter explains basic tasks needed to start solidDB for MySQL.

1.6.1. Starting the Server

If you use Windows, start the solidDB for MySQL server by double clicking mysqld.exe. Alternatively, you can run it from the command line. This starts the solidDB for MySQL server containing solidDB for MySQL.

If you use Linux, start the solidDB for MySQL server by using mysqld_safe. mysqld_safe is a utility that starts solidDB for MySQL after scanning for the needed files and directories (such as the data directory) below the current working directory. In other words, if you have installed solidDB for MySQL under your home directory, mysqld_safe will find it when your current working directory is your home directory. The command syntax is as follows:

mysqld_safe --mysqld=<mysql-server-name> --default-storage-engine=solidDB

Go to your solidDB for MySQL installation data directory and issue, for example, the following command:

mysqld_safe --mysqld=mysqld --default-storage-engine=solidDB

That command starts the solidDB for MySQL server containing solidDB Storage Engine for MySQL.

When started, solidDB for MySQL creates, if necessary, the solidDB database file, transaction log files, and the solidDB message output file to the solidDB for MySQL data directory.

The default solidDB filenames are:

  • solid.db for the database file.

  • sol#####.log for transaction logs. Files start from sol00001.log.

  • solmsg.out for message output.

  • solerror.out for errors occurring during the startup of solidDB Storage Engine for MySQL.

The names and locations of these files are defined in the solidDB for MySQL configuration file, and can be changed according to your specific requirements.

1.6.2. Opening the MySQL Query Tool

Note

These instructions are for the command-line query tool, not for MySQL Query Browser.

You can start the query tool from the Windows menu or from the Linux prompt as follows:

  • When started from the Windows menu, the query tool is set to use the "root" user. At the password prompt, press RETURN.

  • When starting from the prompt in Linux, use command:

    shell> mysql -u root

1.6.3. Creating a Database

You can create a new database by entering commands as follows:

mysql> create database dba;

Query OK, 1 row affected (0.14 sec)

mysql> use dba;

Database changed

You are now ready to use the database.

1.6.4. Shutting Down the Database

You can shut down the database with the MySQL mysqladmin utility by entering a command as follows:

shell> mysqladmin -u root shutdown

This command will shut down solidDB for MySQL. solidDB for MySQL will first perform a checkpoint, close the files it is using, and then stop running.

1.7. solidDB for MySQL Startup Options and System Variables

This section describes the command-line options and system variables for solidDB for MySQL. System variables have two possible states: they are either true or false. System variables can be enabled at server startup by naming them, or disabled by using a skip- prefix. For example, to enable or disable deleting solidDB transaction log files after each successful checkpoint, you can use --soliddb_checkpoint_deletelog or --skip-soliddb_checkpoint_deletelog on the command line, or soliddb_checkpoint_deletelog or skip-soliddb_checkpoint_deleletelog in an option file.

System variables that take a numeric value can be specified as --var_name=value on the command line or as var_name=value in option files.

1.7.1. solidDB for MySQL Command Options

  • soliddb

    This command option enables solidDB Storage Engine for MySQL, if the server was compiled with solidDB support. Use skip-soliddb to disable solidDB.

  • soliddb_checkpoint_deletelog

    If this command option is set, the server deletes the transaction log file(s) after each successful checkpoint. This saves disk space, but makes it impossible to recover data by rolling forward the logs. The transaction logs contain a copy of the transactions executed by the server. If the database file is erased or corrupted, and if you have kept the transaction log files, you can restore the data by restoring the backup database file and then rolling forward all the transaction logs that accumulated since the last backup. If you have deleted those transaction logs, you will lose all transactions since the last successful backup.

1.7.2. solidDB for MySQL System Variables

  • soliddb_backup_block_size

    This variable sets the backup copy block size.

  • soliddb_backupdir

    This variable sets the backup copy directory.

  • soliddb_cache_size

    This variable sets the server's database cache memory size in bytes; the minimum size is 512 kilobytes. Although solidDB for MySQL is able to run with a small cache size, a larger cache size speeds up the server. The cache size needed depends on the database file-size, the number of connected users, and the nature of the operations executed against the server.

    Warning

    Setting the cache size to a value larger than the amount of memory available may significantly degrade performance. If your system only has a small amount of free memory available, reduce the cache size.

  • soliddb_filespec=database_file1 size[,database_file2 size2 ...]

    This variable defines the location and the maximum size of the index file. Note that in solidDB, the term "index file" is used as a synonym for "database file". The parameter accepts the following two arguments: database filename followed with maximum size of the database file, for example:

    soliddb_filespec=c:\soldb\solid.db 20M
    

    Note

    You cannot use space " " or comma "," characters on your path and filenames.

    For more information on adding more database files while the server is running, see Section 1.26, "solidDB File Space Management and Disk I/O".

  • soliddb_durability_level

    This parameter controls whether the transaction durability level is "strict" or "relaxed". If durability is "strict", writes to the transaction log are synchronous. As soon as a transaction has been committed, the transaction is written to the transaction log. If durability is "relaxed", writes are asynchronous, which means that there can be a delay between the time that the transaction is committed and the time that it is logged. For more information on the effect of this parameter see Section 1.14, "Transaction Durability".

    The possible values are:

    1. 1, relaxed durability

    2. 3, strict durability

    Value 2, adaptive durability is not supported with solidDB for MySQL. Adaptive durability is a configuration setting for solidDB Storage Engine that can only be used in Solid EmbeddedEngine™ and BoostEngine™ products. If you specify an unsupported value, the default value 3 is used.

  • soliddb_logdir

    To ensure the durability of committed transactions, transaction results are written immediately to a file in a specified directory when the transaction is committed. This file must be stored to a local drive using local disk names to avoid problems with network input/output (I/O) and to achieve better performance. The default log file directory is the MySQL data directory. The soliddb_logdir parameter defines a path for the transaction log files. For example, the following setting:

    soliddb_logdir = d:\logdir\
    

    instructs solidDB for MySQL to create log files to directory d:\logdir and names them sequentially starting from sol00001.log.

    Tip

    Placing log files on a physical disk separate from the database files improves performance.

  • soliddb_lock_wait_timeout

    The timeout in seconds a solidDB transaction waits for a lock before being rolled back. solidDB automatically detects transaction deadlocks in its own lock table and rolls back the transaction. The default value is 50 seconds.

  • soliddb_log_block_size

    This variable sets the log block size.

  • soliddb_db_block_size

    This variable sets the database file block size.

    Note

    The block size has only effect when the database is created. If you change the block size after you have created the first database, the change will not have effect on the new databases you create, but the same value is used for all database files. If the given block size value differs from the original soliddb_db_block_size size, the soliddb_db_block_size is used and a warning is displayed.

  • soliddb_io_threads

    This variable sets the number of helper I/O threads (for each I/O device) for read and write. You can restrict the number of write threads with the soliddb_write_threads parameter.

  • soliddb_filewrite_flushmode

    This variable sets the flush mode after write or read operations. The possible values are:

    • soliddb_filewrite_flushmode=0 indicates no flushing after write or read operations. This is the default setting on most platforms.

    • soliddb_filewrite_flushmode=1 indicates flush before reading from the file.

    • soliddb_filewrite_flushmode=2 indicates flush after write operations.

  • soliddb_checkpoint_time

    This variable specifies the minimum time in seconds between two checkpoint operations.

  • soliddb_write_threads

    This parameter sets the number of helper threads dedicated to a writing task (for each I/O device). You must define soliddb_io_threads for this parameter to take effect.

  • soliddb_pessimistic

    When you specify PESSIMISTIC concurrency control, the server places locks on rows to control the level of consistency and concurrency when users are submitting queries or updates to the database table rows. The default value is false, that is, the server uses optimistic concurrency control. However, by setting this parameter to true, you can instruct the server to default to pessimistic locking.

    Setting concurrency control to PESSIMISTIC only affects tables created after the setting change. You cannot change the concurrency control behavior for an existing table.

    For more information, see Section 1.19, "Concurrency Control"

  • soliddb_log_enabled

    This variable specifies whether transaction logging is enabled. If transaction logging is disabled, you will get better performance but lower transaction durability. This means that if the database engine shuts down unexpectedly, you will lose all transactions since the last checkpoint. Transaction logging is enabled by default.

  • soliddb_readahead

    This variable sets the number of prefetched index reads during long sequential searches. Note that when the I/O manager is handling a long sequential search, it enters a read-ahead operation mode. This mode ensures that the next file blocks of the search are read into the cache in advance. This naturally improves the overall performance of sequential searches.

  • soliddb_checkpoint_interval

    This variable sets the number of writes to the log files that cause automatic checkpoint creation. A large setting can delay checkpoints and make then larger. A small setting will guarantee a small checkpoint size.

  • soliddb_extend_increment

    This variable sets the number of disk space blocks that are allocated at a time when solidDB allocates more space for the database file.

  • soliddb_lockhash_size

    The server uses a hash table (array) to store lock information. If the array size is remarkably underestimated, the server performance degrades. A too large hash table does not affect directly to the performance, although it causes memory overhead.

1.8. solidDB Data Dictionary

Data dictionary is a file that defines the basic organization of a database. A data dictionary contains a list of all files in the database, the number of records in each file, and the names and types of each field.

1.8.1. solidDB Data Dictionary Installation

solidDB data dictionary can be installed to any database. Data dictionary is only visible to the installed database, or to any other database if you use a database prefix on all SQL clauses accessing the data dictionary.

For example, you can install solidDB data dictionary to database soliddb by issuing the following commands in the MySQL client interface:

shell> mysqladmin create soliddb -u root

shell> mysql soliddb -u root < path_to_install_directory/scripts/soliddb_system_tables.sql

1.8.2. Accessing solidDB Data Dictionary

solidDB data dictionary stores server information. Your ability to access specific system tables depends on your user access rights. For example, Database Administrators (DBA) can view all information on the data dictionary. solidDB data dictionary contains the following tables:

TableDescription
SOLIDDB_SYS_TABLES This table includes information about tables. See also Section 1.8.3.2, "SOLIDDB_SYS_TABLES".
SOLIDDB_SYS_COLUMNS This table includes information about columns. See also Section 1.8.3.3, "SOLIDDB_SYS_COLUMNS".
SOLIDDB_SYS_KEYS This table includes information about keys. See also Section 1.8.3.4, "SOLIDDB_SYS_KEYS".
SOLIDDB_SYS_KEYPARTS This table includes information about key attributes. See also Section 1.8.3.5, "SOLIDDB_SYS_KEYPARTS".
SOLIDDB_SYS_FORKEYS This table includes information about foreign keys. See also Section 1.8.3.6, "SOLIDDB_SYS_FORKEYS".
SOLIDDB_SYS_FORKEYPARTS This table includes information about foreign key attributes. See also Section 1.8.3.7, "SOLIDDB_SYS_FORKEYPARTS".
SOLIDDB_SYS_SCHEMAS This table includes information about schemas (databases). See also Section 1.8.3.8, "SOLIDDB_SYS_SCHEMAS".
SOLIDDB_SYS_SEQUENCES This table includes information about sequences (autoincrement fields are implemented using sequences). See also Section 1.8.3.9, "SOLIDDB_SYS_SEQUENCES".
SOLIDDB_SYS_BLOBS This table includes information about the blobs stored into the database. Furthermore, this table sees to it that the BLOB is physically saved on disk once only even if it is logically saved several times. See also Section 1.8.3.10, "SOLIDDB_SYS_BLOBS".
SOLIDDB_SYS_CARDINAL This table includes information about the number of rows in the table and the size of the data in the table. See also Section 1.8.3.11, "SOLIDDB_SYS_CARDINAL".
SOLIDDB_SYS_INFO This table includes system information. See also Section 1.8.3.12, "SOLIDDB_SYS_INFO".
SOLIDDB_SYS_TABLEMODES This table shows the table mode of the tables whose table mode was explicitly set. It does not show the mode of tables that were left at the default mode (optimistic). See also Section 1.8.3.13, "SOLIDDB_SYS_TABLEMODES".

For example, if you have created a solidDB table t01 using MySQL client as follows:

mysql> use test;

Database changed
    

mysql> create table t01(a int not null, primary key(a)) engine=soliddb;

Query OK, 0 rows affected (0.73 sec)
    

Assuming that you have installed solidDB data dictionary to database soliddb, you can see a description of all solidDB tables by issuing the following command in the MySQL client interface:

mysql> select * from soliddb.SOLIDDB_SYS_TABLES;

+-------+-------------------------+------------+--------------+
| ID    | TABLE_NAME              | TABLE_TYPE | TABLE_SCHEMA |
+-------+-------------------------+------------+--------------+
|   100 | SYS_TABLES              | BASE TABLE | _SYSTEM      |
|   200 | SYS_COLUMNS             | BASE TABLE | _SYSTEM      |
|   400 | SYS_UROLE               | BASE TABLE | _SYSTEM      |
|   500 | SYS_RELAUTH             | BASE TABLE | _SYSTEM      |
|   600 | SYS_ATTAUTH             | BASE TABLE | _SYSTEM      |
|   700 | SYS_VIEWS               | BASE TABLE | _SYSTEM      |
|   800 | SYS_KEYPARTS            | BASE TABLE | _SYSTEM      |
|   900 | SYS_KEYS                | BASE TABLE | _SYSTEM      |
|  1000 | SYS_CARDINAL            | BASE TABLE | _SYSTEM      |
|  1100 | SYS_INFO                | BASE TABLE | _SYSTEM      |
|  1300 | SYS_SYNONYM             | BASE TABLE | _SYSTEM      |
|  8000 | SYS_USERS               | BASE TABLE | _SYSTEM      |
|  8002 | SQL_LANGUAGES           | BASE TABLE | _SYSTEM      |
|  8004 | SYS_TYPES               | BASE TABLE | _SYSTEM      |
|  8006 | SYS_BLOBS               | BASE TABLE | _SYSTEM      |
|  8010 | SYS_FORKEYS             | BASE TABLE | _SYSTEM      |
|  8013 | SYS_FORKEYPARTS         | BASE TABLE | _SYSTEM      |
|  8015 | SYS_CHECKSTRINGS        | BASE TABLE | _SYSTEM      |
|  8017 | SYS_PROCEDURES          | BASE TABLE | _SYSTEM      |
|  8020 | SYS_TRIGGERS            | BASE TABLE | _SYSTEM      |
|  8024 | SYS_TABLEMODES          | BASE TABLE | _SYSTEM      |
|  8026 | SYS_EVENTS              | BASE TABLE | _SYSTEM      |
|  8029 | SYS_CATALOGS            | BASE TABLE | _SYSTEM      |
|  8032 | SYS_SCHEMAS             | BASE TABLE | _SYSTEM      |
|  8035 | SYS_SEQUENCES           | BASE TABLE | _SYSTEM      |
|  8038 | SYS_PROPERTIES          | BASE TABLE | _SYSTEM      |
|  8040 | SYS_HOTSTANDBY          | BASE TABLE | _SYSTEM      |
|  8043 | SYS_COLUMNS_AUX         | BASE TABLE | _SYSTEM      |
| 10000 | SOLIDDB_SYS_TABLES      | BASE TABLE | soliddb      |
| 10002 | SOLIDDB_SYS_COLUMNS     | BASE TABLE | soliddb      |
| 10004 | SOLIDDB_SYS_KEYS        | BASE TABLE | soliddb      |
| 10006 | SOLIDDB_SYS_KEYPARTS    | BASE TABLE | soliddb      |
| 10008 | SOLIDDB_SYS_FORKEYS     | BASE TABLE | soliddb      |
| 10010 | SOLIDDB_SYS_FORKEYPARTS | BASE TABLE | soliddb      |
| 10012 | SOLIDDB_SYS_SCHEMAS     | BASE TABLE | soliddb      |
| 10014 | SOLIDDB_SYS_SEQUENCES   | BASE TABLE | soliddb      |
| 10017 | SOLIDDB_SYS_BLOBS       | BASE TABLE | soliddb      |
| 10019 | SOLIDDB_SYS_CARDINAL    | BASE TABLE | soliddb      |
| 10021 | SOLIDDB_SYS_INFO        | BASE TABLE | soliddb      |
| 10023 | SOLIDDB_SYS_TABLEMODES  | BASE TABLE | soliddb      |
| 10025 | SOLIDDB_ADMIN_COMMANDS  | BASE TABLE | soliddb      |
+-------+-------------------------+------------+--------------+
44 rows in set (0.02 sec)
    

Note

All tables beginning with SYS_ or SQL_ are solidDB internal tables and cannot be accessed from the MySQL client.

1.8.3. solidDB Data Dictionary Contents

This chapter explains the contents of the solidDB system tables.

1.8.3.1. SOLIDDB_ADMIN_COMMANDS

You can add ADMIN commands to this system table.

Column nameData typeDescription
COMMAND VARCHAR(255) The command to be added to the table.
PARAMETERS VARCHAR(1024) NULL The command parameters to be added to the table.
1.8.3.2. SOLIDDB_SYS_TABLES

This table lists all the system tables.

There are no restrictions for viewing the system tables, which means even users with no access rights can view them. However, specific users are restricted from viewing the user table information. Owners are restricted to viewing user tables they have created and users can only view tables to which they have INSERT, UPDATE, DELETE, or SELECT access. Users are restricted from viewing any user tables if they have no access rights. No restrictions apply to DBAs.

Column nameData typeDescription
ID INTEGER NOT NULL Unique table identifier.
TABLE_NAME VARCHAR(254) UNICODE The name of the table.
TABLE_TYPE VARCHAR(254) UNICODE The type of the table (BASE TABLE or VIEW).
TABLE_SCHEMA VARCHAR(254) UNICODE The name of the schema containing TABLE_NAME.
TABLE_CATALOG VARCHAR(254) UNICODE The name of the catalog containing TABLE_NAME.
CREATIME TIMESTAMP The creation time of the table.
CHECKSTRING LONG VARCHAR UNICODE Possible check option defined for the table.
REMARKS LONG VARCHAR UNICODE Reserved for future use.
1.8.3.3. SOLIDDB_SYS_COLUMNS

This table lists all system table columns.

There are no owner or user viewing restrictions for viewing the system columns, which means owners can view columns other than those they have created in this table and users with no access rights or with specific access rights can still view any system column in this table.

Column nameData typeDescription
ID INTEGER NOT NULL Unique column identifier.
REL_ID INTEGER NOT NULL The relation identifier as in SYS_TABLES.
COLUMN_NAME VARCHAR(254) UNICODE The name of the column.
COLUMN_NUMBER INTEGER NOT NULL The number of the column in the table (in creation order).
DATA_TYPE VARCHAR(254) UNICODE The data type of the column.
SQL_DATA_TYPE_NUM SMALLINT ODBC compliant data type number.
DATA_TYPE_NUMBER INTEGER Internal data type number.
CHAR_MAX_LENGTH INTEGER Maximum length for a CHAR field.
NUMERIC_PRECISION INTEGER Numeric precision.
NUMERIC_PREC_RADIX SMALLINT Numeric precision radix.
NUMERIC_SCALE SMALLINT Numeric scale.
NULLABLE CHAR(3) UNICODE Are NULL values allowed (Yes, No).
NULLABLE_ODBC SMALLINT NOT NULL ODBC, are NULL values allowed (1,0).
FORMAT VARCHAR(254) UNICODE Reserved for future use.
DEFAULT_VAL VARBINARY(254) Current default value (if set).
ATTR_TYPE INTEGER User defined (0) or internal (>0).
REMARKS LONG VARCHAR UNICODE Reserved for future use.
1.8.3.4. SOLIDDB_SYS_KEYS

All database tables must have one clustering key. This key defines the physical sorting order of the data. It has no capacity impact. If a primary key is defined, the primary key is used as the clustering key. If no primary key is defined, an entry with key name $CLUSTKEY_xxxxx will be automatically created in SYS_KEYS.

If there is a primary key definition for the table, there will be an entry in SYS_KEYS with a key_name like $PRIMARYKEY_xxxx for this entry. The key_primary and key_clustering columns will have value YES.

If there is no primary key definition for the table, there will be an entry in SYS_KEYS with a key_name like $CLUSTKEY_xxxxx. The key_primary column will have value NO and the key_clustering column will have value YES.

Column nameData typeDescription
ID INTEGER NOT NULL Unique key identifier.
REL_ID INTEGER NOT NULL The relation identifier as in SYS_TABLES.
KEY_NAME VARCHAR(254) UNICODE The name of the key.
KEY_UNIQUE CHAR(3) UNICODE Is the key unique (Yes, No).
KEY_NONUNIQUE_ODBC SMALLINT NOT NULL ODBC, is the key NOT unique (1, 0).
KEY_CLUSTERING CHAR(3) UNICODE NOT NULL Is the key a clustering key (Yes, No).
KEY_PRIMARY CHAR(3) UNICODE NOT NULL Is the key a primary key (Yes, No).
KEY_PREJOINED CHAR(3) UNICODE NOT NULL Reserved for future use.
KEY_SCHEMA VARCHAR(254) UNICODE NOT NULL The owner of the key.
KEY_NREF INTEGER NOT NULL When creating a primary key, the server uses ALL fields of the table, even if the user specified N fields (the N fields specified by the user become the first N fields of the key). KEY_NREF = N, that is, the number of fields specified by the user.
KEY_CATALOG VARCHAR(254) UNICODE Creator name or the owner of the key.
1.8.3.5. SOLIDDB_SYS_KEYPARTS
Column nameData typeDescription
ID INTEGER NOT NULL This column is a foreign key reference to sys_keys.id, so that you can determine which key each keypart is part of.
REL_ID INTEGER NOT NULL The relation identifier as in SYS_TABLES.
KEYP_NO INTEGER NOT NULL Keypart identifier.
ATTR_ID INTEGER Column identifier.
ATTR_NO INTEGER The number of the column in the table (in creation order).
ATTR_TYPE INTEGER The type of the column.
CONST_VALUE VARBINARY(254) Constant value or NULL.
ASCENDING CHAR(3) UNICODE NOT NULL Is the key ascending (Yes) or descending (No).
1.8.3.6. SOLIDDB_SYS_FORKEYS
Column nameData typeDescription
ID INTEGER NOT NULL Foreign key identifier.
REF_REL_ID INTEGER NOT NULL Referenced table identifier.
CREATE_REL_ID INTEGER NOT NULL Creator table identifier.
REF_KEY_ID INTEGER NOT NULL Referenced key identifier.
REF_TYPE INTEGER NOT NULL Reference type.
KEY_SCHEMA VARCHAR(254) UNICODE Creator name.
KEY_CATALOG VARCHAR(254) UNICODE NOT NULL Creator name or the owner of the key.
KEY_NREF INTEGER NOT NULL Number of referenced key parts.
1.8.3.7. SOLIDDB_SYS_FORKEYPARTS
Column nameData typeDescription
ID INTEGER NOT NULL Foreign key identifier.
KEYP_NO INTEGER NOT NULL Keypart number.
ATTR_NO INTEGER NOT NULL Column number.
ATTR_ID INTEGER NOT NULL Column identifier.
ATTR_TYPE INTEGER NOT NULL Column type.
CONST_VALUE VARBINARY(254) Possible internal constant value; otherwise NULL.
1.8.3.8. SOLIDDB_SYS_SCHEMAS

SYS_SCHEMAS lists available schemas.

Column nameData typeDescription
ID INTEGER NOT NULL Schema identifier.
NAME VARCHAR(254) UNICODE NOT NULL Schema name.
OWNER VARCHAR(254) UNICODE NOT NULL Schema owner name.
CREATIME TIMESTAMP NOT NULL Create date and time.
SCHEMA_CATALOG VARCHAR(254) UNICODE Schema catalog.
1.8.3.9. SOLIDDB_SYS_SEQUENCES
Column nameData typeDescription
SEQUENCE_NAME VARCHAR(254) UNICODE NOT NULL Sequence name.
ID INTEGER NOT NULL Unique identifier.
DENSE VARCHAR(3) UNICODE NOT NULL Is the sequence dense or sparse.
SEQUENCE_SCHEMA VARCHAR(254) UNICODE NOT NULL The name of the schema containing SEQUENCE_NAME.
SEQUENCE_CATALOG VARCHAR(254) UNICODE NOT NULL The name of the catalog containing SEQUENCE_NAME.
CREATIME TIMESTAMP Creation time.
1.8.3.10. SOLIDDB_SYS_BLOBS
Column nameData typeDescription
ID BIGINT Blob identifier.
STARTPOS BIGINT Byte offset from the beginning of the blob — the start position of the pages.
ENDSIZE BIGINT Byte offset of the end of the last page +1.
TOTALSIZE BIGINT Total size of the blob.
REFCOUNT INTEGER The number of references, that is, the number of existing instances of the same blob.
COMPLETE INTEGER Indicates whether the write to the blob is ready or not.
STARTCPNUM INTEGER Indicates on what checkpoint level the writing of the blob started.
NUMPAGES INTEGER The number of pages the blob consists of.
P01_ADDR INTEGER First page’s byte offset from the beginning of the blob.
P01_ENDSIZE BIGINT Last byte of the first page + 1.
P[02...50]_ADDR INTEGER Byte offset of pages [2...50] from the beginning of the blob.
P[02...50]_ENDSIZE BIGINT Last byte of the pages [2...50] +1.
1.8.3.11. SOLIDDB_SYS_CARDINAL
Column nameData typeDescription
REL_ID INTEGER The relation identifier as in SYS_TABLES.
CARDIN INTEGER The number of rows in the table.
SIZE INTEGER The size of the data in the table.
LAST_UPD TIMESTAMP The timestamp of the last update in the table.
1.8.3.12. SOLIDDB_SYS_INFO
Column nameData typeDescription
PROPERTY WVARCHAR The name of the property.
VALUE_STR WVARCHAR Value as a string.
VALUE_INT INTEGER Value as an integer.
1.8.3.13. SOLIDDB_SYS_TABLEMODES
Column nameData typeDescription
ID INTEGER Relation identifier.
MODE WVARCHAR Concurrency control mode.
MODIFY_TIME TIMESTAMP Last modify time.
MODIFY_USER WVARCHAR Last user that modified.

1.9. Creating and Using solidDB Tables

To create a solidDB table, specify the ENGINE = solidDB option in the CREATE TABLE statement:

CREATE TABLE customers (a INT, b CHAR (20), INDEX (a)) ENGINE=solidDB;

The statement mentioned previously creates a table and an index on column a in the solidDB database that consists of the data files that you specified in the my.cnf (or my.ini for Windows) file. In addition, solidDB for MySQL creates a customers.frm file in the test directory under the MySQL database directory. Internally, solidDB for MySQL adds an entry for the table to its own data dictionary. The entry includes the database name. For example, if you have a database named test, and you create a table called customers in it, the entry is for 'test/customers'. This means you can create a table of the same name (customers) in another database, and the table names do not collide inside solidDB for MySQL.

You can specify the table type, optimistic or pessimistic, when you create the table. For more information on table modes, see Section 1.19, "Concurrency Control". To create an optimistic table, you can use, for example, the command below:

CREATE TABLE customers (a INT, b CHAR (20), INDEX (a)) ENGINE=solidDB COMMENT='MODE=OPTIMISTIC';

To create a pessimistic table, you can use, for example, the command below:

CREATE TABLE customers (a INT, b CHAR (20), INDEX (a)) ENGINE=solidDB COMMENT='MODE=PESSIMISTIC';

If you specify no table type, the default value OPTIMISTIC is used.

If you want all your (non-system) tables to be created as solidDB tables, you can simply add the line default-storage-engine=soliddb to the [mysqld] section of your server option file.

You can check the table type for an existing table by two methods:

  • If the solidDB system tables are created, you can issue the query below:

    SELECT MODE FROM SOLIDDB_SYS_TABLEMODES, SOLIDDB_SYS_TABLES
     -> WHERE SOLIDDB_SYS_TABLES.TABLE_NAME = 't1' AND
     -> SOLIDDB_SYS_TABLES.ID = SOLIDDB_SYS_TABLEMODES.ID;
            

    The result is such as follows:

    +-------------+
    | MODE        |
    +-------------+
    | PESSIMISTIC | 
    +-------------+
    1 row in set (0.01 sec)
            

  • If you have given the table type in the create command, you can use the query below:

    mysql> show create table t1\g;

    The result is such as follows:

    +-------+----------------------------------------------------------+
    | Table | Create Table                                             |
    +-------+----------------------------------------------------------+
    | t1    | CREATE TABLE 't1' (                                      |
    |       |'a' int(11) NOT NULL,                                     |
    |       |PRIMARY KEY  ('a')                                        |
    |       |) ENGINE=solidDB DEFAULT CHARSET=latin1                   |
    |       |COMMENT='MODE=PESSIMISTIC'                                |
    +-------+----------------------------------------------------------+
    1 row in set (0.02 sec)
            

    Note

    The output has been modified for layout purposes.

1.10. The Character Set Used for Data and Sorting

By default, solidDB for MySQL 5.0 uses the latin1 character set and the latin1_general_cs collation. Additionally, solidDB for MySQL 5.0 supports the UCS2 character set and the ucs2_bin collation for storing Unicode data.

1.11. Limitations on solidDB Tables in This Release

There are a number of known issues with solidDB tables in this release. Solid is already working to address the most serious of these. Known issues:

  • solidDB tables do not support collations.

  • Column index prefixes are not supported. With col_name(N) syntax in an index specification, you can create an index that uses only the first N characters of a string column. Indexing only a prefix of column values in this way can make the index file much smaller. For more information, refer to Column Indexes. For example:

    create table t0(a int not null, b varchar(255), primary key (a), key (b(10))) engine=soliddb;

  • INSERT DELAYED ... is not supported. An attempt to use it leads to an error as follows:

    mysql> insert delayed into isd values (1);
    ERROR 1031 (HY000): Table storage engine for 'isd' doesn't have this option
    			

  • All comparisons for string columns are case-sensitive.

  • Multiple NULL values are not allowed for UNIQUE keys.

  • Optimizer hints given to the storage engine are not implemented. All columns are always retrieved and index-only operations are not optimal. This degrades performance with certain query operations.

  • Ordering of full 32-bit and 64-bit unsigned integer types may not be correct. This is a known error, which could not be fixed on time for the release.

  • BLOB support optimizations are not implemented; memory usage optimizations are needed.

  • Table and column names are limited to 255 bytes.

  • Partial backups are not supported in this release.

  • Point in time recovery is not supported in this release.

  • Although solidDB internally supports row sizes larger than 65535, you cannot define a row containing VARCHAR columns with a combined size larger than 65535. If you try, you get error 1118. For more information, see Section 1.28, "solidDB Error Handling".

  • solidDB tables do not support FULLTEXT indexes.

  • solidDB tables do not support spatial indexes.

  • This version of solidDB for MySQL does not support referential action SET DEFAULT.

  • This version of solidDB for MySQL does not support the REFERENCES clause on a column definition. Use a constraint definition instead. For example:

    mysql> create table parent(a int not null, primary key (a)) engine=soliddb;
    Query OK, 0 rows affected (0.13 sec)
    
    mysql> create table child(a int not null, b int not null references
    parent, primary key(a)) engine=soliddb;
    ERROR 1235 (42000): This version of MySQL doesn't yet support 'REFERENCES'
              

    Instead, use:

    mysql> create table child(a int not null, b int not null, primary key
    (a), constraint fparent foreign key (b) references child) engine=soliddb;
    Query OK, 0 rows affected (0.17 sec)
              
  • The database can hold up to 232 objects, that is, tables, procedures, triggers, indexes, and so on. The same counter (unsigned integer) is used to get IDs for all.

  • The table column limit is 1000. Trying to create a table with more than 1000 columns returns error 13121. For more information, see Section 1.28, "solidDB Error Handling".

  • Server-side cursors are not supported on solidDB.

  • X/Open XA protocol is not supported on solidDB.

  • LOAD INDEX is not implemented on solidDB.

  • SAVEPOINT is not implemented on solidDB.

  • Warning

    Do not convert MySQL system tables in the mysql database from MyISAM to solidDB tables. This is an unsupported operation. If you do this, solidDB for MySQL does not restart until you restore the old system tables from a backup or re-generate them with the mysql_install_db script.

1.12. Dynamic Configuration Settings

Some solidDB system variables are dynamic and can be set at runtime using SET GLOBAL. You can also obtain their values using SELECT. See Using System Variables in MySQL documentation for more information.

The following chapters describe the dynamic solidDB system variables. The options that can be set with the SET statement are also included. Section SET Syntax discusses these options.

Variables that have a type of 'string' take a string value. Variables that have a type of 'numeric' take a numeric value.

Consider, for example, a situation where your database has reached the maximum size specified by soliddb_filespec. You can add a new database file dynamically using a MySQL client as follows:

shell> mysql
shell> SET GLOBAL soliddb_filespec='solid5.db 1G';
shell> exit;

You can only add one database file at a time. If you need to add more than one database file, you must set soliddb_filespec several times.

1.12.1. soliddb_admin_command

The parameter value type is string.

This parameter can have the values explained in the following list. For each value the purpose, syntax, and an example are provided.

  • backup

    This parameter is used to take backups. The syntax is shown below:

    'backup [directory]'
                      

    An example command is shown below:

    mysql> SET GLOBAL soliddb_admin_command='backup';

    An example command with the optional backup directory for Windows is shown below:

    mysql> SET GLOBAL soliddb_admin_command='backup D:\\backupdir';

    An example command with the optional backup directory for Linux is shown below:

    mysql> SET GLOBAL soliddb_admin_command='backup /backup/';

  • checkpoint

    This parameter is used to make a checkpoint. The syntax is shown below:

    'checkpoint'
                      

    An example command is shown below:

    mysql> SET GLOBAL soliddb_admin_command='checkpoint';

  • pmon

    This parameter is used to start or stop performance monitoring. The syntax is shown below:

    'pmon diff {start <file> <interval> [append] | stop}'
                      

    The command to start performance monitoring is shown below:

    mysql> SET GLOBAL soliddb_admin_command='pmon diff start pmon.out 1000';

    The command to stop performance monitoring is shown below:

    mysql> SET GLOBAL soliddb_admin_command='pmon diff stop';

1.12.2. soliddb_backupdir

This parameter defines the backup directory.

The parameter value type is string.

1.12.3. soliddb_filespec

This parameter adds a new database file.

The parameter value type is string.

1.12.4. soliddb_durability_level

This parameter sets the transaction durability level.

The parameter value type is numeric 1-3.

1.12.5. soliddb_checkpoint_time

This parameter sets the checkpoint time interval.

The parameter value type is numeric.

1.12.6. soliddb_lock_wait_timeout

This parameter sets the transaction lock wait timeout.

The parameter value type is numeric.

1.12.7. soliddb_checkpoint_interval

This parameter sets the checkpoint write interval.

The parameter value type is numeric.

1.13. Foreign Key Constraints

In relational databases, it is common for records in one relation to reference records in the same or other relations. The requirement that the referenced records must exist is called referential integrity. References can be made to link information together and it is an essential part of database normalization. One important type of referential integrity is the foreign key constraint.

A foreign key is a referential constraint between two tables in the database. The foreign key identifies a column or a set of columns in one (referencing) table that refers to a column or set of columns in another (referenced) table. The columns in the referenced table must form a primary key or unique key. The values in one row of the referencing columns must occur in a single row in the referenced table. Thus, a row in the referencing table cannot contain values that do not exist in the referenced table. Multiple rows in the referencing table may refer to the same row in the referenced table.

The referencing and referenced table may be the same table, that is, the foreign key refers back to the same table. Such a foreign key is known in SQL:2003 as a self-referencing or recursive foreign key. A table may have multiple foreign keys, and each foreign key may have a different referenced table. Each foreign key is independently forced by the database system. Therefore, cascading relationships between tables can be documented by using foreign keys.

Foreign keys are defined in the ANSI SQL Standard, by using a FOREIGN KEY constraint. The syntax to add such a constraint to an existing table is defined in SQL:2003. Leaving out the column list in the REFERENCES clause means that the foreign key references the primary key of the referenced table.

solidDB for MySQL supports foreign key constraints. solidDB uses the MySQL parser for foreign key definitions. See FOREIGN KEY Constraints in the MySQL 5.0 Reference Manual for more information on foreign keys and Using Foreign Keys in the MySQL 5.0 Reference Manual for more information on how to use foreign keys. Foreign key syntax can be found in CREATE TABLE Syntax and in ALTER TABLE Syntax.

Note

This version of solidDB for MySQL does not support the MATCH option.

solidDB for MySQL requires that both the referencing table and referenced tables are solidDB tables. Additionally, solidDB requires indexes on foreign keys and referenced keys so that foreign key checks can be fast and not require a table scan. The index on the foreign key is automatically created. Corresponding columns in the foreign key and the referenced key must have similar internal data types inside solidDB so that they can be compared without a type conversion. The size and sign of integer types must be the same. The length of string types need not be the same. If you specify a SET NULL action, make sure that you have not declared the columns in the child table as NOT NULL.

The default referential action is ON UPDATE RESTRICT and ON DELETE RESTRICT unless the ON UPDATE and ON DELETE attributes are separately given. Here is an example of creating tables using foreign keys:

CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=SOLIDDB;

CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT NOT NULL, 
FOREIGN KEY fkey(t1_id) REFERENCES t1(id) ON DELETE CASCADE)
ENGINE=SOLIDDB;

If you attempt to insert a row to table t2 with a value that does not exist in the parent table t1, you get an error message:

mysql> insert into t2 values (0, 0);
ERROR 1452 (23000): Cannot add or update a child row: a foreign key
constraint fails (CONSTRAINT 'fkey' FOREIGN KEY ('t1_id') REFERENCES 
't1' ('id') ON DELETE CASCADE ON UPDATE RESTRICT)

You must define tables in such an order that all referenced tables are created before the tables referencing them. If MySQL reports an error number 1005 from a CREATE TABLE statement, and the error message refers to error number 155, then the table creation has failed because a foreign key constraint was not correctly formed. Similarly, if an ALTER TABLE fails and it refers to error number 155, then the table alteration has failed because a foreign key constraint was incorrectly formed for the altered table.

mysql> CREATE TABLE t3 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind
(t1_id), FOREIGN KEY (t1_id) REFERENCES t4(id) ON DELETE CASCADE)
ENGINE=SOLIDDB;

ERROR 1005 (HY000): Can't create table './test/t3.frm' (errno: 155)

You can also see an error message in the server log:

SOLID Table Error 13011: Table t4 does not exist

See below for a more complex example, in which a product_order table has foreign keys for two other tables. One foreign key references a two-column index in the product table. The other references a single-column index in the customer table:

create table customer(customer_id int not null, customer_name
varchar(80), primary key(customer_id)) engine=soliddb;

create table product(product_id int not null, product_price int,
primary key(product_id)) engine=soliddb;

create table product_order(order_id int not null, customer_id int not
null, product_id int not null, number_of_products int,  primary
key(order_id), foreign key (customer_id) references
customer(customer_id), foreign key (product_id) references
product(product_id)) engine=soliddb;

Additionally, the foreign key can reference the same table:

create table t1(a int not null, b int not null, d int, primary key(a),
foreign key (b) references t1(a) on update no action on delete no
action) engine=soliddb;

1.13.1. Referential Actions

A DBMS must ensure the data integrity of the database when rows in a referencing table are deleted or updated. SQL:2003 specifies five different referential actions that will take place in such a case:

  • CASCADE

  • RESTRICT

  • NO ACTION

  • SET NULL

  • SET DEFAULT

Each of the five referential actions will be discussed below.

Action

Description

CASCADE

All dependent rows are deleted if the referenced row is deleted. Likewise, the values in the foreign key columns are updated with the respective values in the referenced row.

RESTRICT

A row in the referenced table cannot be updated or deleted if dependent rows still exist. In that case, no data change is even attempted.

NO ACTION

The UPDATE or DELETE SQL statement is executed on the referenced table. The DBMS verifies at the end of the statement execution that none of the referential relationships is violated. The major difference to RESTRICT is that triggers or the statement semantics itself may give a result in which no foreign key relationship is violated. In that case, the statement can be executed successfully.

SET NULL

The foreign key values in the referencing row are set to NULL when the referenced row is updated or deleted. This is only possible if the respective columns in the referencing table are nullable. Due to the semantics of NULL, a referencing row with NULLs in the foreign key columns does not require a referenced row.

SET DEFAULT

Similarly to SET NULL, the foreign key values in the referencing row are set to the column default when the referenced row is updated or deleted. This version of solidDB for MySQL does not support referential action SET DEFAULT; instead an error message is issued:

create table t6(a int not null, b int not null, primary key(a),
foreign key ger (b) references t1(a) on update set default on delete
set default) engine=soliddb;

ERROR 1005 (HY000): Can't create table './test/t6.frm' (errno: 142)
                  

You can also see an error message in the server log:

070313  9:30:13 [ERROR] This version of MySQL/solidDB does not support
SET_DEFAULT option on referential actions.
              

1.14. Transaction Durability

Normally, when a transaction is committed, the database server writes data to two locations: the database file, and the transaction log file. However, the data are not necessarily written to those two locations at the same time. When a transaction is committed, the server writes the data to the transaction log file immediately, that is, as soon as the server commits the transaction. However, the server does not necessarily write the data to the database file immediately. The server may wait until it is less busy, or until it has accumulated multiple changes, before writing the data to the database file.

If the server shuts down abnormally (due to a power failure, for example) before all data have been written to the database file, the server can recover 100% of committed data by reading the combination of the database file and the transaction log file. Any changes since the last write to the database file are in the transaction log file. The server can read those changes from the log file and then use that information to update the database file. The process of reading changes from the log file and updating the database file is called "recovery". At the end of the recovery process, the database file is 100% up to date.

The recovery process is automatically executed any time that the server restarts after an abnormal shutdown. The process is generally invisible to the user (except that there may be a delay before the server is ready to respond to new requests). Not surprisingly, to have a 100% recovery, you must have 100% of the transactions written to the log file. Normally, the database server writes data to the log file at the same time that the server commits the data. Thus committed transactions are stored on disk and will not be lost if the computer is shut down abnormally. This is called "strict durability". The data that have been committed are "durable", even if the server is shut down abnormally.

If durability is "strict", data are written to the disk drive at the time that the data are committed. The user is not told that his data have been committed until the data were successfully written to the transaction log on disk. This ensures that the data are recoverable if the server shuts down abnormally, for example, due to a power failure. Strict durability makes it almost impossible to lose data unless the hard disk drive itself fails. If durability is "relaxed", the user may be told that the data have been committed even before the data have been written to the transaction log on disk. The server may choose to delay writing the data by, for example, waiting until there are several transactions to write. If durability is relaxed, the server may lose a few committed transactions if there is a power failure before the data are written to disk.

Historically, the goal of most database servers has been to maximize safety, that is, to make sure that data are not lost due to a power failure or other problems. These database servers use "strict durability". This approach is appropriate for many types of data, such as accounting data, where it is often unacceptable to lose track of even a single transaction. Some database servers have been designed to maximize performance, without regard to safety. This is acceptable in situations where, for example, you only need to sample data, or where the server can simply operate on the most recent set of data, regardless of the size of that set.

Suppose, for example, that you have a server containing statistical data about performance, for instance which computers experience the heaviest loads at particular times of the day. You might use such information to balance the load on your computers. This information changes over time, and "old" data are less valuable than "new" data. In fact, you might completely discard any data that are more than a week old. If you were to lose the performance and load balancing data, then your system would still function, and within a week you would have acquired a complete set of new data (assuming that you normally discard data older than one week). In this situation, occasional or small data loss is acceptable, and performance may be more important. solidDB allows you to specify whether you want logging to be "strict" (that is, to guarantee that all committed data can be recovered after an unexpected shutdown) or "relaxed" (that is, to allow some recent transactions to be lost in some circumstances).

You can increase performance by instructing the server that it does not necessarily have to write to the log file at the same time that it commits data. This allows the server to write to the log file later, perhaps when the server is less busy, or when several transactions can be written at once. This is called "relaxed durability". It increases performance by decreasing the I/O load. If you set the transaction durability level to "relaxed", you risk losing some data if the server shuts down abnormally after it has committed some data but before it has written those data to the transaction log. Therefore, you should use relaxed durability only when you can afford to lose a small amount of recent data.

If you can afford to lose a small amount of recent data, and if performance is crucial to you, then you may want to use relaxed durability. Relaxed durability is appropriate when each individual transaction is not crucial. For example, if you are monitoring system performance and you want to store data on response times, you may only be interested in average response times, which will not be significantly affected if you are missing a few pieces of data.

In fact, since measuring performance will itself affect performance (by using up resources such as Central Processing Unit (CPU) time and I/O bandwidth), you probably want your performance tracking operations themselves to have high performance (low cost) rather than high precision. Relaxed durability is appropriate in this situation. On the other hand, if you are tracking financial data, such as bill payments, then you probably want to ensure that 100% of your committed data are stored and recoverable. In this situation, you will want strict durability. You should use relaxed durability only when you can afford to lose a few of the most recent transactions. Otherwise, use strict durability. If you are not sure whether strict or relaxed durability is appropriate use strict durability.

1.15. How AUTO_INCREMENT Columns Work in solidDB

If you specify an AUTO_INCREMENT column for a solidDB table, the table handle in the solidDB data dictionary contains a special sequence object called the "auto-increment sequence object" that is used in assigning new values for the column. This auto-increment sequence object is stored to disk.

If a user does not explicitly specify a value for an AUTO_INCREMENT column, solidDB increments the counter by one and assigns the new value to the column. If the user inserts a row that explicitly specifies the column value, and the value is bigger than the current counter value, the counter is set to the specified column value.

You may see gaps in the sequence of values assigned to the AUTO_INCREMENT column if you roll back transactions that have generated numbers using the counter.

If a user specifies NULL or 0 for the AUTO_INCREMENT column in an INSERT, solidDB treats the row as if the value had not been specified and generates a new value for it.

The behavior of the auto-increment mechanism is not defined if a user assigns a negative value to the column or if the value becomes bigger than the maximum integer that can be stored in the specified integer type.

solidDB supports the AUTO_INCREMENT = N table option in CREATE TABLE and ALTER TABLE statements, to set the initial counter value or alter the current counter value.

1.16. solidDB and TRANSACTION ISOLATION LEVEL

<