I have a table with 22 billion rows and I was asked to do a 30-day trailing sum on certain metrics, partitioned by day, then product. The answers I have found online recommend a self-join to determine this trailing sum, but on a table that is so large, I am extremely hesitant to even test it out from a cost-based perspective.
Is there a way to calculate a trailing sum without doing an extremely costly self-join?