I got database, where I need update values in come cases.
For example I got records table.
It contains information about sessions in beauty salon.
Then clients get booked, I add new record with visit_id, client_id, visit date, status of visit (waiting for client, visit canceled, visit confirmed, visit finished), paid (paid – True, not paid – False), shedule_id (schedule contains staff information), etc.
I should update this table every 15 minutes. Information from this table will be instantly goes to Superset dashboard.
Every update includes new visits and update information about visits (changed status, paid, comment, schedule_id).
So I can’t decide witch engine will work better for this table ReplacingMergeTree or CollapsingMergeTree.
I think I should use CollapsingMergeTree, cause I need get actual info without any delay.
But I can’t get one moment. I must add sing “+1” for new columns and “-1” for old manually.
In my case I get information from API, so I get only actual values. Old values are located only in database.
So I think I need get previous record from database and insert it with sign “-1” manually.
So I stuck at this moment.
Using ReplacingMergeTree engine is not guarantee of drop duplicates.
CollapsingMergeTree – I need add sign to separate old and new version of record, so it’s tooks more time to add records with sign “-1”.
Which engine be better for my case?
CREATE TABLE do_you_database.records
(
record_id UInt32,
plan_id Nullable(UInt64),
schedule_id Nullable(UInt64),
client_id UInt32,
visit_id UInt32,
visit_date Nullable(DateTime),
status Int8,
visit_duration UInt32,
paid bool,
comment Nullable(String),
source Nullable(String),
create_date DateTime,
user_id UInt32,
PRIMARY KEY (record_id)
)
ENGINE = ***