IBM DB2 vs Microsoft SQL Server

Need advice about which tool to choose?Ask the StackShare community!

IBM DB2

245
252
+ 1
19
Microsoft SQL Server

19.8K
15.3K
+ 1
539
Add tool

IBM DB2 vs Microsoft SQL Server: What are the differences?

Both DB2 and SQL Server are popular relational database management systems used by organizations to store and manage their data efficiently. Let's explore the key differences between them.

  1. Licensing Model: The licensing models for IBM DB2 and Microsoft SQL Server differ significantly. DB2 follows a processor-based licensing model, where the cost is based on the number of processor cores on the server. On the other hand, SQL Server follows a combination of Core-based and Server+CAL (Client Access License) licensing models. Core-based licensing requires purchasing licenses for each server core, while Server+CAL licensing requires licenses for both the server and the number of users or devices accessing the server.

  2. Supported Platforms: DB2 is known for its extensive platform support and runs on various operating systems, including Windows, Linux, Unix, and z/OS. In contrast, SQL Server primarily runs on Windows operating systems. While there is a version called SQL Server on Linux, it does not have the same level of platform support as DB2 across multiple operating systems.

  3. Data Type Support: Both DB2 and SQL Server provide support for a wide range of data types. DB2 offers a richer set of native data types, including built-in support for large objects (CLOBs, BLOBs) and pureXML. SQL Server, on the other hand, offers an extensive set of data types but does not have native support for large objects. Instead, it uses the VarBinary data type as an alternative.

  4. Query Optimization: DB2 and SQL Server utilize different query optimization techniques. DB2 employs a cost-based query optimizer that estimates the cost of various access paths and chooses the most efficient one for a given query. SQL Server, on the other hand, uses a rule-based query optimizer that relies on a set of predefined rules to determine the execution plan. While both optimizers aim to improve performance, the approach and optimization techniques differ between the two systems.

  5. SQL Dialect: Although both DB2 and SQL Server are based on the SQL (Structured Query Language) standard, there are certain variances in the SQL dialect they support. DB2 follows the ISO SQL:2003 standard more closely, whereas SQL Server has its own proprietary SQL extensions and syntax. This difference in SQL dialects may require slight modifications to queries when migrating them between the two databases.

  6. Full-Text Search: Full-text search capabilities in DB2 and SQL Server also exhibit differences. DB2 provides its own built-in full-text search engine called Text Search, which allows users to perform advanced text-based searches across multiple columns. SQL Server offers a similar feature called Full-Text Search, which enables efficient searching through large amounts of text stored in SQL Server databases. While both systems provide full-text search capabilities, the underlying mechanisms and syntax may differ.

In summary, DB2 is known for its scalability and support for various platforms, while SQL Server is recognized for its integration with Microsoft technologies and comprehensive business intelligence capabilities.

Advice on IBM DB2 and Microsoft SQL Server

I have a project (in production) that a part of it is generating HTML from JSON object normally we use Microsoft SQL Server only as our main database. but when it comes to this part some team members suggest working with a NoSQL database as we are going to handle JSON data for both retrieval and querying. others replied that will add complexity and we will lose SQL Servers' Unit Of Work which will break the Atomic behavior, and they suggest to continue working with SQL Server since it supports working with JSON. If you have practical experience using JSON with SQL Server, kindly share your feedback.

See more
Replies (2)
TwoBySea

I agree with the advice you have been given to stick with SQL Server. If you are on the latest SQL Server version you can query inside the JSON field. You should set up a test database with a JSON field and try some queries. Once you understand it and can demonstrate it, show it to the other developers that are suggesting MongoDB. Once they see it working with their own eyes they may drop their position of Mongo over SQL. I would only seriously consider MongoDB if there was no other SQL requirements. I wouldn't do both. I'd be all SQL or all Mongo.

See more
Kevin Deyne
Principal Software Engineer at Accurate Background · | 2 upvotes · 49.1K views
Recommends

I think the key thing to look for is what kind of queries you're expecting to do on that JSON and how stable that data is going to be. (And if you actually need to store the data as JSON; it's generally pretty inexpensive to generate a JSON object)

MongoDB gets rid of the relational aspect of data in favor of data being very fluid in structure.

So if your JSON is going to vary a lot/is unpredictable/will change over time and you need to run queries efficiently like 'records where the field x exists and its value is higher than 3', that's a great use case for MongoDB.

It's hard to solve this in a standard relational model: Indexing on a single column that has wildly different values is pretty much impossible to do efficiently; and pulling out the data in its own columns is hard because it's hard to predict how many columns you'd have or what their datatypes would be. If this sounds like your predicament, 100% go for MongoDB.

If this is always going to be more or less the same JSON and the fields are going to be predictably the same, then the fact that it's JSON doesn't particularly matter much. Your indexes are going to approach it similar to a long string.

If the queried fields are very predictable, you should probably consider storing the fields as separate columns to have better querying capabilities. Ie if you have {"x":1, "y":2}, {"x":5, "y":6}, {"x":9, "y":0} - just make a table with an x and y column and generate the JSON. The CPU hit is worth it compared to the querying capabilities.

See more

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:

  1. I need to use either MySQL or PostgreSQL on a Linux based OS. Which would be better for this application?
  2. I have not dealt with a sound based data type before. How do I store that and put it in a table? Thank you.
See more
Replies (6)

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.

See more
Aaron Westley
Recommends
on
PostgreSQLPostgreSQL

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.

See more
Christopher Wray
Web Developer at Soltech LLC · | 3 upvotes · 469.1K views
Recommends
on
DirectusDirectus
at

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!

See more
Julien DeFrance
Principal Software Engineer at Tophatter · | 3 upvotes · 468.6K views
Recommends
on
Amazon AuroraAmazon Aurora

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.

See more
Recommends
on
PostgreSQLPostgreSQL

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,

See more
Klaus Nji
Staff Software Engineer at SailPoint Technologies · | 1 upvotes · 468.7K views
Recommends
on
PostgreSQLPostgreSQL

I recommend Postgres as well. Superior performance overall and a more robust architecture.

See more
Decisions about IBM DB2 and Microsoft SQL Server
Asif Khan
Software Development Engineer at Stier Solution Private Limited · | 10 upvotes · 70.1K views

Easy to start, lightweight and open source.

When I started with PHP, MySQL was everywhere so this is how I started with it. I am no expert in databases but I started learning joins, stored procedures, triggers, etc. with MySQL.

Recently used it in one of my projects - Picfam.com with Node.js + Express backend

See more
Josip Užarević
Senior frontend developer · | 6 upvotes · 71K views

Needed to transform intranet desktop application to the web-based one, as mid-term project. My choice was to use Django/Angular stack - Django since it, in conjunction with Python, enabled rapid development, an Angular since it was stable and enterprise-level framework. Deadlines were somewhat tight since the project to migrate was being developed for several years and had a lot of domain knowledge integrated into it. Definitely was good decision, since deadlines was manageable, juniors were able to enter the project very quickly and we were able to continuously deploy very well.

See more
Manage your open source components, licenses, and vulnerabilities
Learn More
Pros of IBM DB2
Pros of Microsoft SQL Server
  • 7
    Rock solid and very scalable
  • 5
    BLU Analytics is amazingly fast
  • 2
    Native XML support
  • 2
    Secure by default
  • 2
    Easy
  • 1
    Best performance
  • 139
    Reliable and easy to use
  • 101
    High performance
  • 95
    Great with .net
  • 65
    Works well with .net
  • 56
    Easy to maintain
  • 21
    Azure support
  • 17
    Full Index Support
  • 17
    Always on
  • 10
    Enterprise manager is fantastic
  • 9
    In-Memory OLTP Engine
  • 2
    Security is forefront
  • 2
    Easy to setup and configure
  • 1
    Docker Delivery
  • 1
    Columnstore indexes
  • 1
    Great documentation
  • 1
    Faster Than Oracle
  • 1
    Decent management tools

Sign up to add or upvote prosMake informed product decisions

Cons of IBM DB2
Cons of Microsoft SQL Server
    Be the first to leave a con
    • 4
      Expensive Licensing
    • 2
      Microsoft

    Sign up to add or upvote consMake informed product decisions

    What is IBM DB2?

    DB2 for Linux, UNIX, and Windows is optimized to deliver industry-leading performance across multiple workloads, while lowering administration, storage, development, and server costs.

    What is Microsoft SQL Server?

    Microsoft® SQL Server is a database management and analysis system for e-commerce, line-of-business, and data warehousing solutions.

    Need advice about which tool to choose?Ask the StackShare community!

    What companies use IBM DB2?
    What companies use Microsoft SQL Server?
    Manage your open source components, licenses, and vulnerabilities
    Learn More

    Sign up to get full access to all the companiesMake informed product decisions

    What tools integrate with IBM DB2?
    What tools integrate with Microsoft SQL Server?

    Sign up to get full access to all the tool integrationsMake informed product decisions

    What are some alternatives to IBM DB2 and Microsoft SQL Server?
    Oracle
    Oracle Database is an RDBMS. An RDBMS that implements object-oriented features such as user-defined types, inheritance, and polymorphism is called an object-relational database management system (ORDBMS). Oracle Database has extended the relational model to an object-relational model, making it possible to store complex business models in a relational database.
    MySQL
    The MySQL software delivers a very fast, multi-threaded, multi-user, and robust SQL (Structured Query Language) database server. MySQL Server is intended for mission-critical, heavy-load production systems as well as for embedding into mass-deployed software.
    PostgreSQL
    PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions.
    MongoDB
    MongoDB stores data in JSON-like documents that can vary in structure, offering a dynamic, flexible schema. MongoDB was also designed for high availability and scalability, with built-in replication and auto-sharding.
    MSSQL
    It is capable of storing any type of data that you want. It will let you quickly store and retrieve information and multiple web site visitors can use it at one time.
    See all alternatives