Delete old records from a table after a period of time

Database
Enthusiast

Delete old records from a table after a period of time

The problem:

I have a log table that will have a large number of individual inserts or rows each day(about 500).

I want to find a way to be able to delete all the lines that are for example more than 10 days old.

I believe this can be done with triggers. I have searched a lot but couldn't find an implmentation on teradata syntax.

The closest excample I found is this but it does not work in teradata.

http://stackoverflow.com/questions/21235706/create-trigger-for-sqlite-when-new-record-is-inserted-to...

Feel free to suggest other solutions, if any

Tags (2)
1 REPLY
Senior Apprentice

Re: Delete old records from a table after a period of time

Of course you can use a trigger (but change the syntax from sqllite to Teradata), but why trigger a delete whenever there's a new row inserted?

Better run a daily batch job to delete the outdated rows.