I need to create complex queries from events emitted by a smart contract. For example, I need to make a kind of "sql join" between data from different events. I know a simple solution would be to keep a separate database, store all emitted events there and them make all queries from this database. But this solution has two main problems (a) it is centralised and (b) it demands me to keep a database "manually". Is there a clever option to this problem? I understand that it would be difficult to have a decentralized solution to that, but I would like to at least improve problem (b).
It's a common problem and as you've noticed there is no need to reinvent the wheel.
From my experience, the most popular platform that may solve your problem is the Graph which allows you to map events to entities and perform graphql queries on them. Currently, the Graph is centralised but they are committed to decentralising their infrastructure in the future.
Another interesting solution is Dune Analytics. Is a not as well documented as the Graph but offers a nice way to express your queries in sql.
Disclaimer: I'm not connected to any of the companies mentioned above.