Search code examples
cassandracql3

Which is write efficient "create table with option With compact storage" or "create table with option With clustering order storage"?


I am designing schema for a read as as well Write critical Problem statement. Which will be more write and read efficient Create table with compact storage or create table with the Clustering order.

As per my requirement Clustering order helps me to safe some time during reading. but at the same time i fear that it could effect the insertion.

can any one tell ?


Solution

  • Compact storage is for backwards compatibility with thrift apps..I'd recommend avoiding it. From the official docs:

    Using compact storage¶

    The compact storage directive is used for backward compatibility of old applications with CQL. Use the directive to store data in the legacy (Thrift) storage engine format. To take advantage of CQL capabilities, do not use this directive in new applications.

    CREATE TABLE sblocks ( block_id uuid, subblock_id uuid, data blob, PRIMARY KEY (block_id, subblock_id) ) WITH COMPACT STORAGE; Using the compact storage directive prevents you from defining more than one column that is not part of a compound primary key. A compact table using a primary key that is not compound can have multiple columns that are not part of the primary key.

    A compact table that uses a compound primary key must define at least one clustering column. Columns cannot be added nor removed after creation of a compact table. Unless you specify WITH COMPACT STORAGE, CQL creates a table with non-compact storage.¶