docs: def _purge_jobs(timestamp):
      '''
      Purge records from the returner tables.
      :param job_age_in_seconds:  Purge jobs older than this
      :return:
      '''
      with _get_serv() as cursor:
          try:
              sql = 'delete from jids where jid in (select distinct jid from salt_returns where alter_time < %s)'
              cursor.execute(sql, (timestamp,))
              cursor.execute('COMMIT')
          except psycopg2.DatabaseError as err:
              error = err.args
              sys.stderr.write(six.text_type(error))
              cursor.execute("ROLLBACK")
              raise err
  
          try:
              sql = 'delete from salt_returns where alter_time < %s'
              cursor.execute(sql, (timestamp,))
              cursor.execute('COMMIT')
          except psycopg2.DatabaseError as err:
              error = err.args
              sys.stderr.write(six.text_type(error))
              cursor.execute("ROLLBACK")
              raise err
  
          try:
              sql = 'delete from salt_events where alter_time < %s'
              cursor.execute(sql, (timestamp,))
              cursor.execute('COMMIT')
          except psycopg2.DatabaseError as err:
              error = err.args
              sys.stderr.write(six.text_type(error))
              cursor.execute("ROLLBACK")
              raise err
  
      return True