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

后端 未结 11 896
臣服心动
臣服心动 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 22:02

    To add to previous answers :

    • "Full text search might be better supported for MySQL"

    The FULLTEXT index in MySQL is a joke.

    • It only works with MyISAM tables, so you lose ACID, Transactions, Constraints, Relations, Durability, Concurrency, etc.
    • INSERT/UPDATE/DELETE to a largish TEXT column (like a forum post) will a rebuild a large part of the index. If it does not fit in myisam_key_buffer, then large IO will occur. I've seen a single forum post insertion trigger 100MB or more of IO ... meanwhile the posts table is exclusiely locked !
    • I did some benchmarking (3 years ago, may be stale...) which showed that on large datasets, basically postgres fulltext is 10-100x faster than mysql, and Xapian 10-100x faster than postgres (but not integrated).

    Other reasons not mentioned are the extremely smart query optimizer, large choice of join types (merge, hash, etc), hash aggregation, gist indexes on arrays, spatial search, etc which can result in extremely fast plans on very complicated queries.

提交回复
热议问题