postgresqlHow do I truncate a table in PostgreSQL?
To truncate a table in PostgreSQL, you can use the TRUNCATE command. This command removes all rows from the table quickly and efficiently.
Example code
TRUNCATE TABLE my_table;
The code above will remove all rows from the table my_table. No output will be returned.
The TRUNCATE command has the following parts:
TRUNCATE- the command to truncate a tableTABLE- specifies that you are truncating a tablemy_table- the name of the table you are truncating
For more information, please see the PostgreSQL documentation.
More of Postgresql
- How do I use PostgreSQL's XMLTABLE to parse XML data?
- How can I troubleshoot zero damaged pages in PostgreSQL?
- How can I use PostgreSQL with YAML?
- How do I use PostgreSQL's XMIN and XMAX features?
- How can I use PostgreSQL XML functions to manipulate XML data?
- How can I use PostgreSQL XOR to compare two values?
- How can I set a PostgreSQL interval to zero?
- How can Zalando use PostgreSQL to improve its software development?
- How do I use PostgreSQL ZonedDateTime to store date and time information?
- How can I use PostgreSQL's "zero if null" feature?
See more codes...