For a django project, the tests are running slower and slower as the models grow and the number of migrations as well. A single unittest i have timed now at 200s.
I followed this post: http://tech.marksblogg.com/test-django-on-ram-drive.html to work on a ramdrive only for the testing but strangly enough i'm not seeing any improvement.... So i expect something is not going as it should...
I have debugged some and did see the TABLESPACE statements being generated towards postgres, for instance:
... CREATE TABLE ""django_content_type"" (""id"" serial NOT NULL PRIMARY KEY USING INDEX TABLESPACE ""ram_disk"", ""name"" varchar(100) NOT NULL, ""app_label"" varchar(100) NOT NULL, ""model"" varchar(100) NOT NULL) TABLESPACE ""ram_disk""",,,,,,,,,"
Could it be that postgresql rejects it? And how can i test/see if the ram drive is actually being used?
Paul
The advice given in that blog is pretty poor. Don't do that. Not only is it unsafe if you have anything else on your database that you care about, but it's also not going to address WAL and fsync costs, so it won't even be all that much faster.
A ramdisk offers little to no benefit on a modern virtual memory system. You're better off just using postgres as normal, with durability protections turned off for testing purposes.
See Optimise PostgreSQL for fast testing for tips on that.
If you must use a ramdisk / tempfs for some reason,
initdba whole new postgres instance there when you bring up your system. You'll get better results and it's safer.