Reputation: 14989
Right now we're using TRUNCATE
to clear out the contents of 798 tables in postgres (isolated test runs). Where possible we use transactions. However, in places where it's not possible, we'd like the fastest way to reset the state of the DB.
We're working towards only actually calling truncate on the tables that have been modified (for any given test only a few of the 798 tables will be modified).
What is the fastest way to delete all of the data from many PostgreSQL tables?
Upvotes: 3
Views: 209
Reputation: 54191
Two things come to mind:
SET search_path TO %s
).Upvotes: 5