Cosmos DB Cassandra API Indexes that span partitions

Eugene Arutchev 0 Reputation points
2023-05-08T16:33:42.9333333+00:00

We are in the process of moving our application from on prem to Azure. We are currently using Cassandra and the plan is to use Cosmos DB Cassandra API in Azure. In Cassandra, the general rule of thumb is that an index should correspond to single partition, otherwise it is better to use Materialized Views or secondary tables.

Does the same hold true for Cosmos DB? If I have a query that would return ~20 rows of data that come from 20 different partitions, can I accomplish this by using an index (without incurring significant performance or cost penalties), or should I create a secondary table?

As an aside, I am aware that Cosmos DB Cassandra API has recently introduced Materialized Views, but since this feature is still in Preview, we are not going to use it.

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,902 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. GeethaThatipatri-MSFT 29,542 Reputation points Microsoft Employee Moderator
    2023-05-08T19:30:09.41+00:00

    @Eugene Arutchev Welcome to the Microsoft Q&A forum, Thanks for posting your question.

    This “rule of thumb” holds for any distributed database (i.e. one that supports transparent sharding/partitioning), including Cosmos DB. That said, cross-partition queries are not necessarily a disaster if you are not frequent, and the latency is tolerable for the user. If reviewing Cassandra, you may need to consider Cassandra Managed Instance: https://learn.microsoft.com/azure/managed-instance-apache-cassandra/

    Regards

    Geetha


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.