KX Community

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

Home Forums kdb+ Running user defined aggregation on partitioned tables Re: Running user defined aggregation on partitioned tables

  • darrenwsun

    Member
    June 6, 2023 at 12:00 am

    To my knowledge, the best way you can do is to fetch the data into memory and apply the custom aggregate function to the retrieved data, like the below

     

    update percentile:getPercentile price from select sym, price from trade where date>=.z.d-7 // and other filters

     

    Certain function like sum and prd can reduce in a memory-effective way as they don’t need to keep the original values from each partition. However med or your getPercentile function cannot.