Use the truncate command from the CLI or via PGAdmin to delete all rows from a PostgreSQL database. To use PGAdmin follow the directions here or follow the directions below to truncate the table from the CLI.
- Connect: Connect to PostgreSQL with psql.
- Delete Rows: Type the following from the CLI.
- dev=# truncate table <em>table_name</em>
- Verify Data: Verify all the data has been deleted by using the following command.
- dev=# select count(*) from <em>table_name</em>;
- (1 row)