create circular table

Create a new circular database table

Syntax 

create_circular_table:
               CREATE CIRCULAR TABLE [database_name.]table_name [OF] MAXROWS [=] maxrows_num
        (column_def[, column_def]...[, tab_constraint]...)

Description

The CREATE CIRCULAR TABLE statement is used to define a table with a limited number of rows. With circular tables, when the table reaches the row limit RDM will continue to allow new rows to be inserted. These new rows will overwrite existing ones, starting with the oldest. RDM does not allow explicit deletion of rows in a circular table.

It is not advisable to have a FOREIGN KEY in a circular table reference a PRIMARY KEY in a circular table with the on DELETE CASCADE trigger action. When the primary table is full new inserts will delete old rows in the primary table. Those old row deletes will trigger deletes in the foreign table of any rows that reference the row in the primary that is being deleted. The delete in the foreign table will fail because the engine will not allow rows in a circular table to be explicitly deleted, even if it is by the engine when a triggered action is being performed.

Example

create circular table readings of maxrows = 10000(
    r_time        timestamp,
    r_value       uint32
);

See Also

CREATE TABLE