Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. Is truncating a table faster than dropping and re-creating it in SQL? Thanks Azbilegt Chuluunbat

Is truncating a table faster than dropping and re-creating it in SQL? Thanks Azbilegt Chuluunbat

Scheduled Pinned Locked Moved Java
databasequestion
5 Posts 4 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Azbilegt Chuluunbat
    wrote on last edited by
    #1

    I am interested in to see if truncating the table is actually faster than dropping and recreating it? Does one of the write to the log?

    L D B 4 Replies Last reply
    0
    • A Azbilegt Chuluunbat

      I am interested in to see if truncating the table is actually faster than dropping and recreating it? Does one of the write to the log?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      There is a simple way to find the answer.

      1 Reply Last reply
      0
      • A Azbilegt Chuluunbat

        I am interested in to see if truncating the table is actually faster than dropping and recreating it? Does one of the write to the log?

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        What did you find out when you tried both methods?

        Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
        Dave Kreskowiak

        1 Reply Last reply
        0
        • A Azbilegt Chuluunbat

          I am interested in to see if truncating the table is actually faster than dropping and recreating it? Does one of the write to the log?

          B Offline
          B Offline
          BabyYoda
          wrote on last edited by
          #4

          It may depend on things but generally speaking DROP will be faster than TRUNCATE. And TRUNCATE is faster than DELETE.

          1 Reply Last reply
          0
          • A Azbilegt Chuluunbat

            I am interested in to see if truncating the table is actually faster than dropping and recreating it? Does one of the write to the log?

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            I would think that truncating means less "file allocation" processing (just changing a pointer?) Dropping and recreating is essentially creating a new file / entry.

            It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups