4

I typically run my test suites on an in-memory SQLite3 DB. However, I have some projects that absolutely require postgres and raise exceptions with SQLite3. In these cases, how can I improve speed?

I have one test config that runs in 2.97s in sqlite vs. 89.71s in postgres. I mean that's crazy.

I have turned fsync off in postgres - that got me from 101.59s to 89.71s.

1
  • don't keep fsync off. Data corruption can happen that way. Commented Sep 29, 2012 at 3:32

2 Answers 2

1

Your server configuration can certainly have an impact on this speed and turning fsync off will make the table creation faster which is a big part of the initial start up cost.

Another part of this is how Django handles fixtures which can seriously hurt performance if you have a large number of fixtures. Django loads fixtures and rolls back the transaction for each test method (not each test class). There is a third-party app django-fasttest which uses savepoints after the fixture loading to optimize this loading. django-nose has similar optimizations for re-using previously created databases and fixture bundling.

Sign up to request clarification or add additional context in comments.

Comments

0

What's your current configuration? Check the wiki as well.

And start logging slow queries to find the real problems.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.