Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.0 kB
3
Indexable
Never
DROP MATERIALIZED VIEW IF EXISTS hobs_ods_staging.hos_cart_details_by_username;




DROP MATERIALIZED VIEW IF EXISTS hobs_ods_staging.hos_cart_details_by_username;





CREATE MATERIALIZED VIEW hobs_ods_staging.hos_cart_details_by_username_v2 AS
    SELECT *
    FROM hobs_ods_staging.hos_cart_details
    WHERE hoscd_username IS NOT NULL AND hoscd_event_date IS NOT NULL AND hoscd_businessid IS NOT NULL AND hoscd_key IS NOT NULL
    PRIMARY KEY (hoscd_username, hoscd_event_date, hoscd_businessid, hoscd_key)
    WITH CLUSTERING ORDER BY (hoscd_event_date ASC, hoscd_businessid ASC, hoscd_key ASC);




CREATE MATERIALIZED VIEW hobs_ods_staging.hos_cart_details_by_status AS
    SELECT *
    FROM hobs_ods_staging.hos_cart_details
    WHERE hoscd_status IS NOT NULL AND hoscd_event_date IS NOT NULL AND hoscd_businessid IS NOT NULL AND hoscd_key IS NOT NULL
    PRIMARY KEY (hoscd_status, hoscd_event_date, hoscd_businessid, hoscd_key)
    WITH CLUSTERING ORDER BY (hoscd_event_date ASC, hoscd_businessid ASC, hoscd_key ASC);