Microsoft Azure Data FundamentalsDescribe how to work with non-relational data on AzureHard
A company is developing a social media application where users can follow each other, and posts can have many comments. They need a database that can efficiently store and query highly connected data, such as finding all friends of a friend, or all comments on a post and their authors. Which Azure Cosmos DB API is best suited for modeling and querying this type of relationship-heavy data?
- AAzure Cosmos DB (SQL API)
- BAzure Cosmos DB (Gremlin API)
- CAzure Cosmos DB (Cassandra API)
- DAzure Cosmos DB (Table API)
Show answer & explanationAnswer & explanation
Correct answer: B. Azure Cosmos DB (Gremlin API)
Azure Cosmos DB's Gremlin API is a graph database service specifically designed for modeling and querying highly connected datasets. It uses the Apache TinkerPop Gremlin query language, which is ideal for traversing relationships between entities like users and their connections, or posts and their comments.
Why the other options are wrong
- A. SQL API is a document database, less efficient for complex graph traversals and relationship queries.
- C. Cassandra API is for columnar data, not optimized for graph traversals.
- D. Table API is a key-value store, unsuitable for complex relationship modeling.
Azure Cosmos DB (Gremlin API)
A graph database service within Azure Cosmos DB that enables modeling and querying highly connected datasets using the Apache TinkerPop Gremlin query language.
- Optimized for storing and querying relationships between entities.
- Uses the Gremlin traversal language for powerful graph queries.
- Ideal for social networks, recommendation engines, fraud detection, etc.
- Data is stored as vertices (nodes) and edges (relationships).
Memory trick: Gremlin is like a 'spider' expertly navigating its web of connections.