Truncate usage in oracle and oracletruncate usage

Source: Internet
Author: User

Truncate usage in oracle and oracletruncate usage
Truncate in oracle
Syntax: truncate table;
You can use the truncate Statement (DDL language) to delete all records in a table. The truncate statement is usually much faster to delete data than to delete data. This is because no rollback information is generated when the truncate statement is used to delete data. Therefore, the truncate statement cannot be rolled back, there are few system and transaction log resources used.
The DELETE statement deletes a row at a time and records one row in the transaction log. Truncate table deletes data by releasing the data pages used to store TABLE data, and only records the release of pages in transaction logs.
You can also use the reuse storage keyword in the truncate statement to indicate the space occupied by the record after the record is deleted. In contrast, if you use the drop storage keyword, this indicates that the space occupied by the deleted record is recycled immediately. The drop storage keyword is used by default.
SQL> create table tt (
2 tid number (4)
3 );
SQL> insert into tt values (1 );
One row has been created.
SQL> insert into tt values (2 );
One row has been created.
SQL> insert into tt values (3 );
One row has been created.
SQL> insert into tt values (4 );
One row has been created.
SQL> insert into tt values (5 );
One row has been created.
SQL> truncate table tt reuse storage;
The table is truncated.
SQL> select * from tt;
Unselected row

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.