How to Truncate a Table in PostgreSQL

Be very careful with this command. It will empty the contents of your PostgreSQL table. This is useful in development, but you'll rarely want to do this in production.

truncate my_table

If you have a serial ID column and you'd like to restart its sequence (ie restart IDs from 1):

truncate my_table restart identity
database icon
Shared queries and folders ✅ Version history ✅ One-click connection to PostgreSQL ✅
Get more done, together, with PopSQL and PostgreSQL