Creating or altering tables to use DSE In-Memory
Use CQL directives to create and alter tables to use DSE In-Memory.
Use CQL directives to create and alter tables to use DSE In-Memory and dse.yaml to limit the size of tables.
Creating a table to use DSE In-Memory
To create a table that uses DSE In-Memory, add a CQL directive to the CREATE TABLE statement. Use the compaction directive in the statement to specify the MemoryOnlyStrategy class, disable compression, and disable the key and row caches.
CREATE TABLE customers (
uid text,
fname text,
lname text,
PRIMARY KEY (uid)
) WITH compaction= { 'class': 'MemoryOnlyStrategy' }
AND compression = {'sstable_compression' : ''}
AND caching = {'keys':'NONE', 'rows_per_partition':'NONE'};
Altering an existing table to use DSE In-Memory
Use the ALTER TABLE statement to change a traditional table to use
in-memory, or to change an in-memory table to a traditional table. For example, use the
DESCRIBE
command for a table named employee. Verify that employee is a
traditional table because the output of the DESCRIBE
command does not
include a line that looks something like:
compaction={'class': 'MemoryOnlyStrategy'} >
Alter the employee table to use DSE In-Memory and, as a best practice, disable caching:
ALTER TABLE employee WITH compaction= { 'class': 'MemoryOnlyStrategy' }
AND compression = {'sstable_compression' : ''}
AND caching = {'keys':'NONE', 'rows_per_partition':'NONE'};
Limiting the size of tables
max_memory_to_lock_fraction | Specify a fraction of the system memory. The default value of 0.20 specifies to use up to 20% of system memory. |
max_memory_to_lock_mb | Specify a maximum amount of memory in MB. |
Installer-Services | /etc/dse/dse.yaml |
Package installations | /etc/dse/dse.yaml |
Installer-No Services | install_location/resources/dse/conf/dse.yaml |
Tarball installations | install_location/resources/dse/conf/dse.yaml |
Disabling caching on tables
ALTER TABLE customers WITH caching = {'keys':'NONE',
'rows_per_partition':'NONE'};