I would surely look at ClickHouse for such use case.
If you're rolling your own solution (rather than using DBaaS) ClickHouse is unparalleled when it comes to scaling and efficiency. Its SQL is somewhat restricted but it should be able to do what you're looking very well, especially it was born out of the needs of Yandex Metrica which is quite similar use case of yours.
If you're using Kubernetes there is great Operator available from Altinity to run Clickhouse on Kubernetes.