temporal
temporal copied to clipboard
Remove indexes from schema Temporal in cassandra
Hello!
I found creating indexes in schema description:
CREATE INDEX cm_lastheartbeat_idx on cluster_membership (last_heartbeat);
CREATE INDEX cm_sessionstart_idx on cluster_membership (session_start);
As i know, indexes are not very good works in cassandra for big clusters because have a lot of restrictions.
Have you considered to create invert tables instead of using indexes - like tables cluster_membership_by_last_heartbeat and cluster_membership_by_session_start to detect correct membership_partition value and query with this to cluster_membership table?
CREATE TABLE cluster_membership_by_last_heartbeat
(
last_heartbeat timestamp,
membership_partition tinyint,
PRIMARY KEY (last_heartbeat)
) WITH COMPACTION = {
'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'
};
CREATE TABLE cluster_membership_by_session_start
(
session_start timestamp,
membership_partition tinyint,
PRIMARY KEY (session_start)
) WITH COMPACTION = {
'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'
};
Thanks a lot!