I know that Redis allows you to optimize the structure of complex data structures. But I am wondering if there are any databases or design patterns that allow you to specify optimized versions of the blocks of your database.
For example, to quickly search through text, you need to resort to solr to search, which is its own database to optimize string browsing.
Another example: if you want to return an easily movable role object to the user, you might need the following:
var user = { roles: { admin: true, principal: true, ... } }
But the database probably has a table rolesand a table users, so you do a join and retrieve them back and end up creating this data structure manually in your code.
The question is, is there something that allows you to specify the data structure / form of your data directly in the database for faster searches. Databases allow you to have indexes, which are a primitive solution. Consider if there are more complex examples. For example, a great way to check if an element has a tag:
user.tags[tagName]
This means your tags look like this:
{ tagA: true, tagB: true, ... }
But you will probably get them from the database as follows:
[ { name: tagA }, { name: tagB } ]
, , , " " "", , . , - .