#31473: Use PostgreSQL TRUNCATE … RESTART IDENTITY keyword to reset sequences in
sql_flush()
-------------------------------------+-------------------------------------
Reporter: Jon | Owner: nobody
Dufresne |
Type: | Status: new
Cleanup/optimization |
Component: Database | Version: master
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Rather than executing an additional query per truncated table, can
truncate and reset sequences in a single query by using the `RESTART
IDENTITY` syntax.
My project uses the `sql_flush()` operation internally and profiling shows
that it can consume a large percentage of the runtime. Reducing the number
of queries to one should help provide a small performance improvement.
--
Ticket URL: <https://code.djangoproject.com/ticket/31473>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/052.b7ac1e171e63237545d647e10083f22d%40djangoproject.com.