I know what data structures is, How it works & importance of it. I just have some doubts on where do we actually use it.
When database can do filtering, fetching, sorting efficiently, Why we need to use data structures in db data?
I was working on a project which uses Cassandra database. In that I'd to filter data based on two fields. The two fields are indexed. But I can't filter it as it will force me to use Allow filtering but It's not a recommended one.
In this case I thought to fetch rows filtered by one indexed column & rest by our program (Java/Python etc) so we need to use better data structure here. Is this a correct approach? If not what's the solution for these kind of problems?
Let's assume I've billions of list of string data in a db table, I want to use it for autocomplete for that it's better to use tries data structure, How can I do this? fetch all data into memory and process?
If my approach is wrong, Are data structures mainly used for in memory data?