We recently bought some new hardware for a database server which we were intending to dedicate to the operation of PostgreSQL. However now we have the requirement to also run MySQL as some software we want to use only supports that database. Since the storage on this machine is the most suitable for hosting a DB, and we don't currently have the budget for more hardware,we're thinking of running both of them on the same server.

Are there any caveats or best practices we should be aware of?


It really depends on your load. The big difference between MySQL and PostgreSQL is that MySQL preallocates its data buffers on start and then manages them on its own and PostgreSQL relies on OS file caching instead. Imagine a situation when an OS file cache gets too small, PostgreSQL performance will degrade then. Several active MySQL databases on the same host "know" about each other because they share the same internal data structures, but PostgreSQL usually does not expect concurrent RDBMS on the same host. I run PostgreSQL and MySQL on the same host under quite a heavy load and finally got OS file cache shortage, had to move PostgreSQL to a separate host.


My only useful advice on the subject: keep your Postgres transaction log files on a separate physical disk from your Pg and/or MySQL datastores, which can probably coexist. The transaction logs are huge sequential write chunks, and Pg will perform much much better if you can keep that IO sequential by isolation, rather than letting it get randomized with all the other datastore IO.


I've run medium-scale databases using both database engines, and found it to be no worse than two or more active databases on the same engine. It doesn't seem to matter which is using the memory cache or disk bandwidth, or if it's a lot of usage on just one.

  • Agreed. There might be some small additional memory overhead having a second engine running, but it's a trivial amount compared to the database-specific I/O and memory usage, which are the likeliest bottlenecks you'd run into. They don't use the same port or default file paths, so there shouldn't be anything to worry about. – daveadams Feb 8 '11 at 4:00
  • It's proably not so much the size of the databases that matters I'd think the big issue would be the usage patterns. Probably I'd say the biggest problem is likely to be disk contention. If one or both of the DBs are mainly read intensive and you have enough memory for disk cache, probably no probs. However if both DBs want to write or you dont have much memory for disk cache then I'd be wary. – Jason Tan Feb 8 '11 at 15:40

Without knowing anything about the kinds of loads you're expecting it's kind of difficult to give a really meaningful answer but the short of it is:

No real technical problems running both systems on the same machine and in fact many (most?) shared hosting providers do exactly that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.