Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
3.0 kB
1
Indexable
Never
CREATE TABLE hobs_ods_staging.cart_details (
    businessid text,
    createdtime timestamp,
    key text,
    buid text,
    opid text,
    status text,
    type text,
    updatedtime timestamp,
    username text,
    value blob,
    valuetype text,
    PRIMARY KEY (businessid, createdtime, key)
) WITH CLUSTERING ORDER BY (createdtime ASC, key ASC)

the below desin schema is my materiliazed view for above table

CREATE MATERIALIZED VIEW hobs_ods_staging.hos_cart_details_by_status AS
    SELECT *
    FROM hobs_ods_staging.hos_cart_details
    WHERE status IS NOT NULL AND event_date IS NOT NULL AND username IS NOT NULL AND valuetype IS NOT NULL AND key IS NOT NULL
    PRIMARY KEY (status, event_date, valuetype, key, username)
 WITH CLUSTERING ORDER BY (event_date ASC, valuetype ASC, key ASC, username ASC)
    AND additional_write_policy = '99p'
    AND bloom_filter_fp_chance = 0.01
    AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
    AND cdc = false
    AND comment = ''
    AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
    AND compression = {'chunk_length_in_kb': '16', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND memtable = 'default'
    AND crc_check_chance = 1.0
    AND extensions = {}
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair = 'BLOCKING'
    AND speculative_retry = '99p';

the below table is also same as above one

CREATE MATERIALIZED VIEW hobs_ods_staging.hos_cart_details_by_date AS
    SELECT *
    FROM hobs_ods_staging.hos_cart_details
    WHERE event_date IS NOT NULL AND status IS NOT NULL AND username IS NOT NULL AND valuetype IS NOT NULL AND key IS NOT NULL
    PRIMARY KEY (event_date, status, valuetype, key, username)
 WITH CLUSTERING ORDER BY (status ASC, valuetype ASC, key ASC, username ASC)
    AND additional_write_policy = '99p'
    AND bloom_filter_fp_chance = 0.01
    AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'}
    AND cdc = false
    AND comment = ''
    AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}
    AND compression = {'chunk_length_in_kb': '16', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}
    AND memtable = 'default'
    AND crc_check_chance = 1.0
    AND extensions = {}
    AND gc_grace_seconds = 864000
    AND max_index_interval = 2048
    AND memtable_flush_period_in_ms = 0
    AND min_index_interval = 128
    AND read_repair = 'BLOCKING'
    AND speculative_retry = '99p';

now from above all schemas i have designed i should not get tombstome error while doing oprations because the volume of data is very high close to 1million.do something