SQL DB Space issue

  • Hi Guys,

    I have an issue with my SQL DB.

    we have space issue on our DB. its found that one table is continuously growing .. it stores session ID and details etc. This table has no date/time column. now the problem is I can't delete some random from this table but I want to delete based on the age of the record being inserted. without date/time column how can I retrieve older records from this table?

    This table has no possibility no join with any other tables in the DB.

    thanks!!

  • You can't.

    SQL doesn't keep track of the insert time of rows. To delete from a table based on the age of the row, you need a column which records the date the row was inserted.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Without a datetime component in the table and without the possibility to join to another table to get that information, you are somewhat stuck.

    You would need to add a column to track the timestamp from when records are inserted.

    What is the purpose of the table? Does anybody actually look at the data in the table? If the data is just for web session information, the session details should have a time in there. But if nobody looks at the table, why gather that info?

    If the data is pointless more than 1 day out, then why keep it? You could trunc the table at the end of the day if it isn't looked at beyond a day out.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • What other columns are in the table? Any identity or key values you store?

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply