Managing Disk space by deleting the older records when the disk is 60% full

Moderator: NorbertKrupa

sKwa
Newbie
Newbie
Posts: 15
Joined: Wed Aug 02, 2017 3:12 pm

Re: Managing Disk space by deleting the older records when the disk is 60% full

Post by sKwa » Fri Aug 11, 2017 11:38 pm

Hi!
rishireddy.bokka wrote:
Fri Aug 11, 2017 9:23 pm
Thanks for the reply.
For nothing, you are welcome.

rishireddy.bokka wrote:
Fri Aug 11, 2017 9:23 pm
Please let me know if you need more information.
It's enough.

Ok, lets say out table name is MyTable and table is partitioned by column eventTime(just for example):

dbadmin=> select eventTime from MyTable order by eventTime desc;
         eventTime          
----------------------------
 2018-01-01 00:56:12.734092    // year 2018, newest timestamp
 ...
 2017-08-12 00:58:53.244886
 2017-08-11 00:56:12.734092
 2017-08-10 00:56:12.734092
 2017-08-09 00:56:12.734092    // year 2017, oldest timestamp
(366 rows)

so an oldest partition is:

dbadmin=> select to_char(min(eventTime), 'MMDD')::INT from MyTable;
 to_char 
---------
     809
(1 row)

P.S.
Assumption: data <= 1 year.

P. P.S.
Say me if you need a help to write a Bash or Python script.

rishireddy.bokka
Newbie
Newbie
Posts: 5
Joined: Mon Aug 07, 2017 4:24 pm

Re: Managing Disk space by deleting the older records when the disk is 60% full

Post by rishireddy.bokka » Mon Aug 14, 2017 9:51 pm

Thanks alot for the help :)
This works perfectly :)

Post Reply

Return to “Vertica SQL”