I am using Ruby on the rails supported by the oracle database and memcached for my current project.
There is a rather heavy function used that relies on individual database views as a data source, and this data source internally has other database views and tables inside.
This is a virtual db view to have access to everything from one place, and not to a materialized db view.
Users in most cases, if they are in the function that they want to update, it is therefore important to keep the data up to date.
When retrieving data from this view, I include the connection security table in the view (the security table is not part of the view itself), which contains some fields that we use to control access to data at a more narrow level. For example, the security table has columns user_id, prop_1, prop_2 , where prop_1, prop_2 are the columns available on the db view, and user_id is the registered user. Some users have the same details in the security table, say prop_1 = 1 and prop_2 = 1 , but can also have prop_1 , like another user, but have different prop_2 as prop_1 = 2 and prop_2 = 1 . There are many different combinations of prop_1 and prop_2, think of them as FK for another table, so you can have many records.
To date, the time to get entries in the application is almost 10 seconds, it is quite slow. I am considering an alternative approach.
Firstly, it was a materialized view, but since the user makes frequent updates, this may not be the best choice, since updating the view may take some time.
Secondly, I thought it was a cache to use the combination of prop_1 and prop_2 as a composite key for the underlying data, since many users have the same combination, and one who has the same combination can access those same data.
However, this approach may require more rewriting and logic to save and retrieve data in fragments, rather than from the same place with a single query, as in the database view.
In your experience, how did you feel about the same / similar issue? Or is there a better approach I could try?
For those of you who are going to ask what you tried. At first I think of a solution, collecting information from reliable resources and more experienced people, then I am going to make an informed decision and begin to implement it. The implementation at first, thinking secondly, was mistaken so many times