Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 47493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T16:07:53+00:00 2026-05-10T16:07:53+00:00

What’s the difference between TRUNCATE and DELETE in SQL? If your answer is platform

  • 0

What’s the difference between TRUNCATE and DELETE in SQL?

If your answer is platform specific, please indicate that.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T16:07:54+00:00Added an answer on May 10, 2026 at 4:07 pm

    Here’s a list of differences. I’ve highlighted Oracle-specific features, and hopefully the community can add in other vendors’ specific difference also. Differences that are common to most vendors can go directly below the headings, with differences highlighted below.


    General Overview

    If you want to quickly delete all of the rows from a table, and you’re really sure that you want to do it, and you do not have foreign keys against the tables, then a TRUNCATE is probably going to be faster than a DELETE.

    Various system-specific issues have to be considered, as detailed below.


    Statement type

    Delete is DML, Truncate is DDL (What is DDL and DML?)


    Commit and Rollback

    Variable by vendor

    SQL*Server

    Truncate can be rolled back.

    PostgreSQL

    Truncate can be rolled back.

    Oracle

    Because a TRUNCATE is DDL it involves two commits, one before and one after the statement execution. Truncate can therefore not be rolled back, and a failure in the truncate process will have issued a commit anyway.

    However, see Flashback below.


    Space reclamation

    Delete does not recover space, Truncate recovers space

    Oracle

    If you use the REUSE STORAGE clause then the data segments are not de-allocated, which can be marginally more efficient if the table is to be reloaded with data. The high water mark is reset.


    Row scope

    Delete can be used to remove all rows or only a subset of rows. Truncate removes all rows.

    Oracle

    When a table is partitioned, the individual partitions can be truncated in isolation, thus a partial removal of all the table’s data is possible.


    Object types

    Delete can be applied to tables and tables inside a cluster. Truncate applies only to tables or the entire cluster. (May be Oracle specific)


    Data Object Identity

    Oracle

    Delete does not affect the data object id, but truncate assigns a new data object id unless there has never been an insert against the table since its creation Even a single insert that is rolled back will cause a new data object id to be assigned upon truncation.


    Flashback (Oracle)

    Flashback works across deletes, but a truncate prevents flashback to states prior to the operation.

    However, from 11gR2 the FLASHBACK ARCHIVE feature allows this, except in Express Edition

    Use of FLASHBACK in Oracle http://docs.oracle.com/cd/E11882_01/appdev.112/e41502/adfns_flashback.htm#ADFNS638


    Privileges

    Variable

    Oracle

    Delete can be granted on a table to another user or role, but truncate cannot be without using a DROP ANY TABLE grant.


    Redo/Undo

    Delete generates a small amount of redo and a large amount of undo. Truncate generates a negligible amount of each.


    Indexes

    Oracle

    A truncate operation renders unusable indexes usable again. Delete does not.


    Foreign Keys

    A truncate cannot be applied when an enabled foreign key references the table. Treatment with delete depends on the configuration of the foreign keys.


    Table Locking

    Oracle

    Truncate requires an exclusive table lock, delete requires a shared table lock. Hence disabling table locks is a way of preventing truncate operations on a table.


    Triggers

    DML triggers do not fire on a truncate.

    Oracle

    DDL triggers are available.


    Remote Execution

    Oracle

    Truncate cannot be issued over a database link.


    Identity Columns

    SQL*Server

    Truncate resets the sequence for IDENTITY column types, delete does not.


    Result set

    In most implementations, a DELETE statement can return to the client the rows that were deleted.

    e.g. in an Oracle PL/SQL subprogram you could:

    DELETE FROM employees_temp WHERE       employee_id = 299  RETURNING   first_name,             last_name INTO        emp_first_name,             emp_last_name; 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 87k
  • Answers 87k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Google Code University (several languages there) Python Podcasts Python Learning… May 11, 2026 at 5:27 pm
  • Editorial Team
    Editorial Team added an answer Bytecode Outline plugin for Eclipse to play with bytecode you… May 11, 2026 at 5:27 pm
  • Editorial Team
    Editorial Team added an answer Since WinForms controls are rendered by the unmanaged user32.dll skinning… May 11, 2026 at 5:27 pm

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
What is a programmer’s life like?

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.