postgresql truncate cascade restart identity
snippet in sql

restart identity cascade

user1347

TRUNCATE <table_name> RESTART IDENTITY CASCADE;
--RESTART will reset the identity sequence
--CASCADE all tables that have a foreign key reference to 
--table_name will be truncated as well

postgresql truncate cascade restart identity

user5338

TRUNCATE bigtable, fattable RESTART IDENTITY;