Sno. | Truncate | Delete |
1 | It is a DDL command | It's a DML command |
2 | DDL because it use schema lock | DML because it uses row level lock usually |
3 | Truncate doesn't support from and where clause | Delete supports from and where clause |
4 | syntax: Truncate table Emp | Syntax: Delete from table Syntax: Delete from emp where id =10 |
5 | Truncate is minimally logged operation makes it faster | It is fully logged operation makes it comparatively slow |
6 | It doesn't activate the table's after delete trigger. | It activate the table's after delete trigger |
7 | This resets identity key values | It doesn't impact identity key values |
8 | Truncate cant be roll back in transaction | Delete can be rolled back |
9 | You can't use TRUNCATE TABLE where the tables are referenced by a foreign key constraint | Delete can be used when the tables are referenced by a foreign key constraint |
10 | You can't use TRUNCATE TABLE where the tables participate in an indexed view. | Delete can be used when the tables participate in an indexed view. |
11 | You can't use TRUNCATE TABLE where the tables participate in transactional replication | Delete can be used when the tables participate in transactional replication |
12 | You can't use TRUNCATE TABLE where the tables participate in merge replication. | Delete can be used when the tables participate in merge replication. |
13 | It free the space containing the table. | It does not free the space containing the table. |
14 | TRUNCATE removes the data by deallocating the data pages | Delete just remove the data from pages / Pages |
15 | Truncate cannot be issued over a database link in Oracle | Delete can be issued over a database link |
16 | Truncate generates a good amount of redo transactions only | Delete generates a good amount of redo and undo transactions |
Labels
- ERP (34)
- Slides (27)
- Analytics (25)
- SQL Server (16)
- Data Science (13)
- Business Analytics (10)
- Python (9)
- Installation (8)
- Spark (8)
- BPE (7)
- Big Data Analytics (7)
- DBMS (7)
- BDA (6)
- MongoDB (6)
- EXCEL (5)
- Lab (5)
- NoSQL (5)
- Database (4)
- Error (4)
- HADOOP (4)
- Interview Questions (4)
- SQL (3)
- Spark Lab (3)
- DBA (2)
- ITIL (2)
- Machine learning (2)
- Marketing Analytics (2)
- Storm (2)
- Tableau (2)
- pyspark (2)
- AI (1)
- Charts (1)
- Data Engineering (1)
- Docker (1)
- English (1)
- GMAT (1)
- HDFS (1)
- Kubernetes (1)
- ML (1)
- Natural Language Processing (1)
- Operating Sytem (1)
- Power BI (1)
- R (1)
- Regression (1)
- SQL Scripts (1)
- Samuel A (1)
- Visualization (1)
!->
No comments:
Write comments