Home Which one to choose between Postgres and MySQL
Post
Cancel

Which one to choose between Postgres and MySQL

This depends on your application.

Choose Postgres

Frequent Write operation

why?

Postgres has secondary index architecture. So re-balancing operation cost of insert & delete is cheaper than Clustered index.
However, postgres create a process with large memory (almost 10 MB) per connection. This is the cause of lower speed in read operation comparing to MySQL using thread. Also, Massive read operation is inefficient by random IO because postgres only supports non-clustered index.

Refer to Clustered index vs non-clustered index

Choose MySQL

High volumes of reads.
MySQL supports clustered index, so massive read is more efficient than Postgres.
Random I/O is can be avoided.

MySQL has two types threads, foreground and background

MySQL’s Threads

Foreground thread

Read operation from buffer or cache.
Borrow a thread from thread pool.
A thread request connection to Connection pool, if there’s not available (idle) connection it should wait for other thread to return the connection.

⚠️ MySQL community edition doesn’t support connection pool.

Background thread

Usually, Do write operation especially between buffer <-> disk.

  • Merge inserting buffers.
  • Logging to disk
  • Monitoring Lock & Deadlock

🔗 References

This post is licensed under CC BY 4.0 by the author.

B-Tree and B+Tree

How to decide composite index

Trending Tags