2

I just wonder whether I start with PostgreSQL or sqlite3 when starting Django project.

I usually start with sqlite3, which is a default database, and change it into PostgreSQL at the time to deploy.

I use TDD and heard that it is much faster when use PostgreSQL as a database. Is it right? If so, do I have to use PostgreSQL from the start?

Need some advices. Thanks

user3595632
  • 5,380
  • 10
  • 55
  • 111
  • 1
    There are a lot of differences between databases that ORMs rarely protect you from (case sensitivity of LIKE, GROUP BY behavior, `varchar(n)` size handling, date/time functions, column types, ...). You should develop, test, and deploy on the same stack IMO. – mu is too short Oct 23 '16 at 03:56
  • 2
    I agree with @muistooshort. I don't know that TDD is faster with PostgreSQL, but you really need to test what you intend to deploy. If you're deploying to PostgreSQL, you need to test under PostgreSQL. – Mike Sherrill 'Cat Recall' Oct 23 '16 at 16:30

1 Answers1

0

You can't really say that PostgreSQL is faster. If you don't have a complex DB schema and/or a lot of models, sqlite may probably be a lot faster, since it will be run in-memory when running tests.

However, if you have complex schema and a lot of migrations - PostgreSQL and --keepdb flag would be better. However, do remember that that way your database still exists after running the tests.