On 03/20/2017 02:43 PM, Josh Berkus wrote:
If I truncate the same table and then again insert rows should start
with 1 in “ID” column.
That's not how it works, normally. I'd suggest adding an ON TRUNCATE
trigger to the table.
Actually that may not be necessary as long as you make sure to use the
RESTART IDENTITY option when running TRUNCATE. I would argue that is a
cleaner solution than using triggers, if you can get away with it.
https://www.postgresql.org/docs/9.6/static/sql-truncate.html
Andreas
--
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance