Opened 11 years ago
Last modified 2 years ago
#24306 new New feature
Support for UNLOGGED tables in PostgreSQL
| Reported by: | freyley | Owned by: | nobody | 
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | dev | 
| Severity: | Normal | Keywords: | testing unlogged postgresql | 
| Cc: | Petr Přikryl | Triage Stage: | Accepted | 
| Has patch: | no | Needs documentation: | no | 
| Needs tests: | no | Patch needs improvement: | no | 
| Easy pickings: | no | UI/UX: | no | 
Description
According to stack overflow, unlogged tables are the way to go for testing speed. See http://stackoverflow.com/questions/9407442/optimise-postgresql-for-fast-testing/9407940#9407940 for example. 
As part of another, now rejected ticket, somebody wrote support for unlogged tables:
https://github.com/aptivate/django/commits/ticket_19891 first commit: https://github.com/aptivate/django/commit/657a1fee1ad3899f1254a971f32a6cea7b11c0a3
Support for unlogged tables for testing would be really helpful for having tests run faster. 
Change History (6)
comment:1 by , 11 years ago
| Triage Stage: | Unreviewed → Accepted | 
|---|---|
| Version: | 1.7 → master | 
comment:2 by , 10 years ago
comment:3 by , 9 years ago
Replying to freyley:
Support for unlogged tables for testing would be really helpful for having tests run faster.
I've tried this a while ago (by hacking Django's internals) and there was not much gain from it.
But I was using most(?) of https://www.postgresql.org/docs/current/static/non-durability.html already.
comment:4 by , 5 years ago
| Cc: | added | 
|---|
comment:5 by , 2 years ago
A different use for UNLOGGED tables could be for the database cache backend: https://martinheinz.dev/blog/105. Would it be an option to allow specifying an --unlogged parameter for the createcachetable command to create an UNLOGGED table for the database cache?
comment:6 by , 2 years ago
Some discussion here. Looks like the Postgresql-specific option may be a problem, and the UNLOGGED feature may not give much performance improvement for caches.
According to discussion on django-developers unlogged tables actually decreased performance for Django's own test suite.