MySQL vs PostgreSQL? Which should I choose for my Django project?

后端 未结 11 862
臣服心动
臣服心动 2020-11-30 21:27

My Django project is going to be backed by a large database with several hundred thousand entries, and will need to support searching (I\'ll probably end up using djangosear

11条回答
  •  伪装坚强ぢ
    2020-11-30 21:49

    Even if Postgresql looks better, I find it has some performances issues with Django:

    Postgresql is made to handle "long connections" (connection pooling, persistant connections, etc.)

    MySQL is made to handle "short connections" (connect, do your queries, disconnect, has some performances issues with a lot of open connections)

    The problem is that Django does not support connection pooling or persistant connection, it has to connect/disconnect to the database at each view call.

    It will works with Postgresql, but connecting to a Postgresql cost a LOT more than connecting to a MySQL database (On Postgresql, each connection has it own process, it's a lot slower than just popping a new thread in MySQL).

    Then you get some features like the Query Cache that can be really useful on some cases. (But you lost the superb text search of PostgreSQL)

提交回复
热议问题