drop, and rebuild table, or delete all rows?

Discussion in 'Databases' started by grobar, May 21, 2008.

  1. #1
    I have an application that tracks a weekly SLA for something, and resets at the end of the week.

    the table used is ONLY used for that, and so, we need to essentially empty the table at the end of the week. (Sunday midnight)

    Question - which is better (for size and performance)

    a) - just delete all rows?
    b) - drop the table and recreate

    its a msSQL database.
     
    grobar, May 21, 2008 IP
  2. grobar

    grobar Well-Known Member

    Messages:
    642
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    140
    #2
    nm, using the SQL truncate command...
     
    grobar, May 21, 2008 IP
  3. apmsolutions

    apmsolutions Peon

    Messages:
    66
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yes, truncate is the way to go....along with removing all data, it will also reset the seed of your identity field if you had one.
     
    apmsolutions, May 21, 2008 IP
  4. kashi

    kashi Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Insted of dropping a table you can truncate this.because by doing this your rows will be deleted but your structure of table will remain s there.
     
    kashi, May 25, 2008 IP
  5. freeadlists

    freeadlists Guest

    Messages:
    57
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    yeah, I agree. Truncating is the way to go.
     
    freeadlists, May 25, 2008 IP