temporalio / temporalio/temporal

Remove indexes from schema Temporal in cassandra

Open
#5,543 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
23.2k
Forks
1.9k
Avg merge
2d 8h
Merged PRs (30d)
228

Description

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!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with schema/cassandra/temporal/schema.cql around line 185 and review the two cluster_membership index definitions. Evaluate the proposed inverted tables and determine the complete schema change needed to remove the indexes; done means the replacement design is agreed and the schema is updated consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
cassandra
Domain
databases
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.