Results 1 to 4 of 4

Thread: Auto Truncate

  1. #1
    Join Date
    Aug 2011
    Posts
    3

    Unanswered: Auto Truncate

    Have Postgresql setup for a simple log capture database. Anyone know how to tell the program to automatically truncate entries that are older than 30 days?

    My logging software cannot do it and I'd like to do this at the DB automatically.

  2. #2
    Join Date
    Aug 2011
    Location
    Glasgow, UK
    Posts
    36
    What OS are you using?

    For eample if it's Linux/Unix -- you could create a cron job and schedule once a day, every day it to call your sql script that deletes rows > 30 days.

    If it's windows use a scheduled task to call your sql delete script.

    Alternatively, use a tool like pgAgent:
    http://www.pgadmin.org/download/pgagent.php
    http://www.pgadmin.org/docs/1.12/pgagent.html
    Last edited by marc_; 09-01-11 at 11:25. Reason: Added links

  3. #3
    Join Date
    Aug 2011
    Posts
    3
    Great! Got it to work perfect with PGAgent.

  4. #4
    Join Date
    Aug 2011
    Location
    Glasgow, UK
    Posts
    36
    No worries - Glad it worked for you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •