内存数据库中的Postgresql django [英] Postgresql in memory database django
问题描述
提前感谢
这是过早的优化。即使您运行在冷金属硬盘上,Postgresql也非常快,只要您使用正确的索引。如果你不坚持在磁盘上的数据,那么你可以打开自己一个痛苦的世界。
另一方面,如果你想通过运行加速测试一个在内存中的postgresql数据库,你可以尝试类似这些非耐久性优化:
http://www.postgresql.org/docs/9.1/static/non-durability.html
最激烈的建议是在该页面上使用 ramdisk 。 如何设置一个。在遵循OS / Postgresql步骤后,编辑django settings.py并将表空间添加到DATABASES部分。
最后但并非最不重要的:这只是一个完全浪费时间。
For performance issues I would like to execute an optimization algorithm on an in memory database in django (I'm likely to execute a lot of queries). I know it's possible to use a sqlite in memory (How to run Django's test database only in memory?) but I would rather use postgresql because our prod database is a postgresql one.
Does someone knows how to tell django to create the postgresql database in the memory ?
Thanks in advance
This is premature optimization. Postgresql is very very fast even if you are running it on a cold metal hard disk provided you use the right indexes. If you don't persist the data on disk, you are opening yourself upto a world of pain.
If on the other hand you want to speed up your tests by running an in memory postgresql database you can try something like these non durability optimizations:
http://www.postgresql.org/docs/9.1/static/non-durability.html
The most drastic suggestion is to use a ramdisk on that page. Here's how to set up one. After following the OS/Postgresql steps edit django settings.py and add the tablespace to the DATABASES section.
Last but not least: This is just a complete waste of time.
这篇关于内存数据库中的Postgresql django的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!