KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums KX Solutions DC_ARCHIVE directory format Re: DC_ARCHIVE directory format

  • leahs

    Member
    January 26, 2022 at 12:00 am

    Hello Damian,

    Thanks for reaching out here.

    DC_ARCHIVE is an inbuilt file maintenance mechanism in KX Control. It allows you to archive and delete files in a Unix sense.

    However, it seems clearer now (and correct me if I am wrong) that you are continuously ‘upserting’ to a flat table within the HDB daily, and your intention is to delete older rows in that table.

    In this case, the archive solution is not appropriate as that is for files only.

    In order to delete rows older than 7 days in that flat table, you can avail of another inbuilt process template in Control called DS_EXEC_ANALYTIC. The process template allows for scheduled execution. I have documented the implementation steps here: DS_EXEC_ANALYTIC Template

    In your case, your target process will be the relevant HDB and the supplied analytic should work to delete the rows in that flat table.

    Useful links for your analytic logic and for dealing with flat tables:

    https://code.kx.com/q/ref/get/

    https://code.kx.com/q/ref/get/#set

    https://code.kx.com/q/ref/delete/#table-rows

    In summary, the archiving process template is great for managing file maintenance. However, when maintaining a flat table, we recommend the use of DS_EXEC_ANALYTIC here for scheduled execution of row removal.

    Please let me know if you encounter any issues with the above or have any further questions.

    Kind regards,

    Leah