Skip to main content
Question

Partition by a compound key

  • June 1, 2020
  • 0 replies
  • 8 views

Bryan_H
Forum|alt.badge.img+2

I have a customer who needs to partition a table by two keys: account category and date, to allow efficient deletes by category and date with DROP_PARTITIONS. However, HASH doesn't work because the keys don't come out in order. I've tried a few ways to create a compound key that can be sorted by concatenating category and date into a string, but Vertica doesn't like anything I've yet tried. I tried a CREATE FUNCTION to wrap the expression, but UDF are not allowed. Customer tried passing the concatenate expression in the PARTITION BY, but got "ERROR 2552: Cannot use meta function or non-deterministic function in PARTITION BY expression".
Any thoughts? I'll keep trying but feel I am missing something obvious here!