Amazing srticle! Thank you very much!
In this piece, that also a missuse of ROW_NUMBER(), which requires sorting. If you want ot get last of first payment, you want to use:
```
QUALIFY
MAX(payment_ts) OVER (PARTITION BY user) = payment_ts
```
You don't need to sort data, meaning you save…