Mysql – Will I need more system resources to run DB2 instead of MySQL

db2linuxMySQL

I need to convert my web application from MySQL to run on DB2. I need to know in advance whether I will need a high spec server to ensure the web application performs at the same speed as it does now on MySQL.

The application is a very database intensive data analysis application with a browser interface. It is only using about 20% of the available CPU power, and 30% of the memory on the server now. Would it take more CPU or memory if converted to DB2? Would I need a high spec server?

I am just looking for any general feel of whether a server upgrade would be required for a MySQL to DB2 conversion if everything else remains equal (database size, traffic, etc).

Best Answer

I have administered both MySQL and DB2 database systems. In general, I'd say that DB2 requires more memory and more administration. But sometimes, you can use DB2's sophisticated features to perform queries which are much more efficient.

About memory and administration: DB2 is not very good at making good use of RAM. Either you spend a lot of time fine-tuning its memory config, or you use its automatic memory configuration ("STMM") and accept that it will waste a depressingly high percentage of your RAM. And DB2 has a bunch of other small annoyances which add up to a need for significant need for administration. Example: If you create a database, it will not be automatically "activated" at boot time, meaning that the first connection to it will take forever (a script can help you, but why-oh-why is that needed).

About sophisticated features: If you take the (potentially long) time to study some DB2 features such as index-only scans, OLAP queries, semantic query optimizations (where the optimizer can sometimes take advantage of constraints defined in the tables), materialized views, etc, then there are situations where you can make things go orders of magnitude faster compared to a simpler database system. And if/when you make something run much faster through design and queries, then you can cut down on CPU, RAM and I/O requirements.

If you have large amounts of data, then you also need to think about backups: Do you need to back up your data? If so, what options do the database systems provide? - There is not much fun about an otherwise fast system which is often held back due to long running and I/O-saturating backups. DB2's backup+restore has many annoying characteristics, but it does also have interesting features such as the ability to split data into hot+cold data (via separation into tablespaces), incremental or delta backups, etc. Last time I looked at MySQL, the backup options were less sophisticated.