개념
휘발성(Volatile) 테이블은 모든 데이터가 임시 메모리 공간에 상주하고, 로그 테이블과의 Join을 통해 데이터 결과를 풍부하게 만드는 임시 테이블이다.
휘발성 테이블은 로그 테이블에 간략한 기호나 숫자로 표현된 특정 디바이스나 장비의 다양한 정보를 담고 있는 부가 정보 테이블이라고 할 수 있다. 고속으로 입력 및 갱신이 가능하여 데이터의 현재 상태 (시계열 데이터와는 맞지 않음) 를 실시간으로 유지해야 하는 경우에 많이 사용한다.
이 테이블의 특성은 다음과 같다
스키마 보존
휘발성 테이블의 구조(스키마) 정보는 Machbase 서버가 종료되었다가 다시 구동이 되더라도 유지된다. 해당 테이블을 삭제하기 위해서는 명시적으로 DROP table을 수행하면 된다.
데이터 휘발성
휘발성 테이블에 담긴 데이터는 서버를 종료하는 즉시 모두 사라진다. 따라서 서버의 구동 시에 휘발성 테이블의 내용을 다시 INSERT 해야 한다.
인덱스 제공 및 Join 기능
휘발성 테이블의 빠른 데이터 접근을 위해 실시간에 최적화된 인덱스인 RED-BLACK 인덱스를 제공한다. 따라서 로그 테이블과의 Join 이나 검색 과정에서 효율적으로 활용될 수 있다.
테이블 컬럼에서 기본 키(Primary Key) 를 지정할 수 있다.
중복되는 기본 키 값을 가진 데이터를 삽입하는 경우, 기존 데이터의 값을 갱신(UPDATE)할 수 있다.
조건 절 (
WHERE
절)을 이용해, 기본 키 값 조건과 일치하는 데이터를 삭제할 수 있다._ARRIVAL_TIME
컬럼이 존재하지 않는다.
기본 키(Primary Key)
기본 키는 테이블 컬럼 값의 유일성(Uniqueness) 제약 조건을 형성하고 테이블 데이터를 구별할 키 컬럼을 지정하는 목적으로 생성할 수 있다.
기본 키가 지정된 휘발성 테이블에 데이터를 삽입할 때, 삽입 데이터의 기본 키 컬럼 값은 테이블 안의 다른 기본 키 컬럼 값들과 반드시 달라야 한다. 이 제약사항을 유일성 조건이라고 할 수 있다.
기본 키의 생성 제약사항은 다음과 같다.
기본 키는 휘발성 테이블에서만 생성할 수 있다.
기본 키 컬럼은 1개만 지정할 수 있으며, 2개 이상의 컬럼을 함께 기본 키로 지정할 수 없다.
갱신(UPDATE) 기능
다른 테이블 유형과는 다르게, 휘발성 테이블은 제한적이나마 갱신 기능을 제공한다.
삽입하고자 하는 데이터의 기본 키 값이 이미 다른 데이터의 기본 키 값 중 하나와 중복되는 경우에는 '삽입' 이 아니라 '갱신' 모드로 전환되며, 중복된 키 값을 가진 기존 데이터의 다른 컬럼 값이 삽입하고자 하는 데이터의 컬럼 값으로 변경된다. 기본 키가 지정된 휘발성 테이블에서만 갱신 기능을 사용할 수 있으며, 삽입 과정에서 기본 키 값을 지정하지 않았을 때는 갱신 기능을 사용할 수 없다.
삭제(DELETE) 기능
휘발성 테이블은 기본 키 값을 이용해 특정 데이터를 삭제할 수 있는 기능을 제공한다.
DELETE 구문에서 조건 절(WHERE
절)을 추가해 기본 키 값을 지정하면, 해당 기본 키 값에 해당하는 데이터가 존재하는 경우에 한하여 이를 삭제할 수 있다. 기본 키가 지정된 휘발성 테이블에서만 삭제 기능을 사용할 수 있으며, 이 때 조건 절에 들어갈 수 있는 조건은 (기본 키 컬럼) = (값)
으로 제한되어 있다.
...
Concept
...
The volatile table is a temporary table in which all the data resides in the temporary memory space and enriches the data through joining with the log table.
The volatile table is a supplementary information table that stores various information of a specific device or equipment represented by a simple symbol or a number in a log table. It can be input and updated at high speed, and is used in a case where the present state of the data (which does not match the time series data) needs to be maintained in real time.
The characteristics of this table are as follows
Preserving Schema
The structure (schema) information of the volatile table is maintained even if the Machbase server is shut down and then restarted. To drop the table, you need to explicitly execute the DROP table.
Data Volatility
The data in the volatile table disappears as soon as the server is shut down. Therefore, when the server is started, the contents of the volatile table must be INSERTed again.
Index Providing and Join Function
It provides a RED-BLACK index, which is a real-time optimized index for fast data access of volatile tables. Therefore, it can be efficiently used in Join and searching process with log tables.
You can specify a primary key in the table column.
When inserting data having a duplicate primary key value, it is possible to UPDATE the value of existing data.
The condition clause (
WHERE
clause) can be used to delete data that matches the primary key value condition.The
_ARRIVAL_TIME
column does not exist.
Primary Key
The primary key can be created to form a unique constraint on a table column value and to specify a key column to distinguish table data.
When inserting data into a volatile table with a primary key specified, the primary key column value of the insert data must be different from the other primary key column values in the table. This constraint is called a unique constraint.
The creation constraints of the primary key are as follows.
Primary keys can only be created in volatile tables.
You can specify only one primary key column, and you can not specify more than one column as primary keys.
Update Function
Unlike other table types, volatile tables provide a limited update function.
If the primary key value of the data to be inserted overlaps with one of the primary key values of the other data, the mode is changed to the 'update' mode instead of 'insertion', and another column value of the existing data having the duplicated key value is inserted, it is changed to the column value of the data to be processed. The update function can be used only in the volatile table with the primary key specified. If the primary key value is not specified during the insertion, the update function can not be used.
Delete Function
Volatile tables provide the ability to delete specific data using primary key values.
If you add a condition clause (WHERE
clause) in the DELETE clause to specify a primary key value, you can delete it only if there is data corresponding to that primary key value. The delete function can be used only on the volatile table with the primary key specified, and the condition (Primary Key Column) = (Value)
that can be entered in the condition clause is limited.
...
Child pages (Children Display) |
---|