LOCK MODE Options
Use the LOCK MODE options to specify the locking granularity of the new table.
Granularity | Effect |
---|---|
PAGE | Obtains and releases one lock on a whole page of rows If neither the IFX_DEF_TABLE_LOCKMODE environment variable nor the DEF_TABLE_LOCKMODE configuration parameter has set a default locking granularity, this is the system default. Page-level locking is especially useful when you know that the rows are grouped into pages in the same order that you are using to process all the rows. For example, if you are processing the contents of a table in the same order as its cluster index, page locking is appropriate. |
ROW | Obtains and releases one lock per row Row-level locking provides the highest level of concurrency. If you are using many rows at one time, however, the lock-management overhead can become significant. You might also exceed the maximum number of locks available, depending on the configuration of your database server, but Informix® can support up to 18 million locks on 32-bit platforms, or 600 million locks on 64-bit platforms. Only tables with row-level locking can support the LAST COMMITTED isolation level feature. |
Examples of setting the locking granularity
CREATE TABLE IF NOT EXISTS tsTab_j(
id INT NOT NULL PRIMARY KEY,
ts TIMESERIES(ts_data_j)
) LOCK MODE ROW;
CREATE TABLE Tab5 (C1 IDSSECURITYLABEL,
C2 int,
C3 char (10) COLUMN SECURED WITH label6)
SECURITY POLICY company
LOCK MODE PAGE;
ALTER TABLE Tab5 LOCK MODE(ROW);
The SET LOCK MODE statement of SQL has no effect on the locking granularity of tables. For the syntax and semantics, see SET LOCK MODE statement.