Opened 9 years ago

Last modified 8 months 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 Tim Graham, 9 years ago

Triage Stage: UnreviewedAccepted
Version: 1.7master

comment:2 by Tim Graham, 9 years ago

According to discussion on django-developers unlogged tables actually decreased performance for Django's own test suite.

in reply to:  description comment:3 by Daniel Hahler, 8 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 Petr Přikryl, 3 years ago

Cc: Petr Přikryl added

comment:5 by bcail, 8 months 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 bcail, 8 months 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.

Note: See TracTickets for help on using tickets.
Back to Top