Need advice about which tool to choose?Ask the StackShare community!
Azure Cosmos DB vs Microsoft SQL Server: What are the differences?
Introduction
Azure Cosmos DB and Microsoft SQL Server are both popular databases offered by Microsoft. While they serve the purpose of storing and managing data, there are several key differences between them.
Scalability: Azure Cosmos DB is designed to be highly scalable, allowing it to handle massive amounts of data and transactions across multiple regions. It uses a globally distributed architecture that enables automatic scaling and replication. On the other hand, Microsoft SQL Server is more suitable for smaller to mid-sized applications, as it is not as easily scalable and requires manual configuration for scaling.
Data Model: Azure Cosmos DB is a NoSQL database that supports various data models, including key-value, document, column-family, and graph. This provides flexibility in storing and retrieving data based on the specific requirements of the application. In contrast, Microsoft SQL Server follows a relational data model, where data is organized into tables with predefined schemas. This structure is best suited for applications that require strict data integrity and complex relationships between entities.
Availability: Azure Cosmos DB offers a high level of availability with its global distribution and multi-region replication. It provides automatic failover and data redundancy, ensuring minimal downtime and data loss in the event of a failure. On the other hand, Microsoft SQL Server's availability relies on the infrastructure it is deployed on, requiring manual configuration for achieving high availability through technologies like clustering or replication.
Consistency: Azure Cosmos DB provides multiple consistency models to choose from, including strong, bounded staleness, session, and eventual consistency. These models allow developers to balance between data consistency and performance based on their application requirements. In contrast, Microsoft SQL Server follows the ACID (Atomicity, Consistency, Isolation, Durability) properties, providing strong consistency by default.
Developer-friendly: Azure Cosmos DB offers extensive support for different programming models and API interfaces, making it easier for developers to work with. It supports popular languages and frameworks like .NET, Java, Node.js, and RESTful APIs. On the other hand, Microsoft SQL Server primarily uses the Transact-SQL (T-SQL) language, which requires developers to have knowledge and experience in SQL programming.
Cost: Azure Cosmos DB's pricing model is based on throughput and storage consumption, allowing users to pay for the resources they need. It offers different pricing tiers and flexibility in scaling resources up or down based on demand. In contrast, Microsoft SQL Server follows a traditional licensing model, where users purchase licenses based on the edition and number of cores. This can be more expensive for larger deployments and may require additional investment for hardware infrastructure.
In summary, Azure Cosmos DB and Microsoft SQL Server differ significantly in terms of scalability, data models, availability, consistency, developer-friendliness, and cost. While Azure Cosmos DB offers high scalability, flexible data models, and automatic availability, Microsoft SQL Server provides a relational data model, strong consistency, and familiarity with SQL programming.
I am a Microsoft SQL Server programmer who is a bit out of practice. I have been asked to assist on a new project. The overall purpose is to organize a large number of recordings so that they can be searched. I have an enormous music library but my songs are several hours long. I need to include things like time, date and location of the recording. I don't have a problem with the general database design. I have two primary questions:
- I need to use either MySQL or PostgreSQL on a Linux based OS. Which would be better for this application?
- I have not dealt with a sound based data type before. How do I store that and put it in a table? Thank you.
Hi Erin,
Honestly both databases will do the job just fine. I personally prefer Postgres.
Much more important is how you store the audio. While you could technically use a blob type column, it's really not ideal to be storing audio files which are "several hours long" in a database row. Instead consider storing the audio files in an object store (hosted options include backblaze b2 or aws s3) and persisting the key (which references that object) in your database column.
Hi Erin, Chances are you would want to store the files in a blob type. Both MySQL and Postgres support this. Can you explain a little more about your need to store the files in the database? I may be more effective to store the files on a file system or something like S3. To answer your qustion based on what you are descibing I would slighly lean towards PostgreSQL since it tends to be a little better on the data warehousing side.
Hi Erin! First of all, you'd probably want to go with a managed service. Don't spin up your own MySQL installation on your own Linux box. If you are on AWS, thet have different offerings for database services. Standard RDS vs. Aurora. Aurora would be my preferred choice given the benefits it offers, storage optimizations it comes with... etc. Such managed services easily allow you to apply new security patches and upgrades, set up backups, replication... etc. Doing this on your own would either be risky, inefficient, or you might just give up. As far as which database to chose, you'll have the choice between Postgresql, MySQL, Maria DB, SQL Server... etc. I personally would recommend MySQL (latest version available), as the official tooling for it (MySQL Workbench) is great, stable, and moreover free. Other database services exist, I'd recommend you also explore Dynamo DB.
Regardless, you'd certainly only keep high-level records, meta data in Database, and the actual files, most-likely in S3, so that you can keep all options open in terms of what you'll do with them.
Hey Erin! I would recommend checking out Directus before you start work on building your own app for them. I just stumbled upon it, and so far extremely happy with the functionalities. If your client is just looking for a simple web app for their own data, then Directus may be a great option. It offers "database mirroring", so that you can connect it to any database and set up functionality around it!
Hi Erin,
- Coming from "Big" DB engines, such as Oracle or MSSQL, go for PostgreSQL. You'll get all the features you need with PostgreSQL.
- Your case seems to point to a "NoSQL" or Document Database use case. Since you get covered on this with PostgreSQL which achieves excellent performances on JSON based objects, this is a second reason to choose PostgreSQL. MongoDB might be an excellent option as well if you need "sharding" and excellent map-reduce mechanisms for very massive data sets. You really should investigate the NoSQL option for your use case.
- Starting with AWS Aurora is an excellent advise. since "vendor lock-in" is limited, but I did not check for JSON based object / NoSQL features.
- If you stick to Linux server, the PostgreSQL or MySQL provided with your distribution are straightforward to install (i.e. apt install postgresql). For PostgreSQL, make sure you're comfortable with the pg_hba.conf, especially for IP restrictions & accesses.
Regards,
I recommend Postgres as well. Superior performance overall and a more robust architecture.
Pros of Azure Cosmos DB
- Best-of-breed NoSQL features28
- High scalability22
- Globally distributed15
- Automatic indexing over flexible json data model14
- Tunable consistency10
- Always on with 99.99% availability sla10
- Javascript language integrated transactions and queries7
- Predictable performance6
- High performance5
- Analytics Store5
- Rapid Development2
- No Sql2
- Auto Indexing2
- Ease of use2
Pros of Microsoft SQL Server
- Reliable and easy to use139
- High performance101
- Great with .net95
- Works well with .net65
- Easy to maintain56
- Azure support21
- Always on17
- Full Index Support17
- Enterprise manager is fantastic10
- In-Memory OLTP Engine9
- Easy to setup and configure2
- Security is forefront2
- Great documentation1
- Faster Than Oracle1
- Columnstore indexes1
- Decent management tools1
- Docker Delivery1
- Max numar of connection is 140001
Sign up to add or upvote prosMake informed product decisions
Cons of Azure Cosmos DB
- Pricing18
- Poor No SQL query support4
Cons of Microsoft SQL Server
- Expensive Licensing4
- Microsoft2
- Data pages is only 8k1
- Allwayon can loose data in asycronious mode1
- Replication can loose the data1
- The maximum number of connections is only 14000 connect1