Reputation: 971
I have a table named 'Customers' which has all the information about users with different types (user, drivers, admins) and I cannot separate this table right now because it's working on production and this is not a proper time to do this.
so If I make 3 views: the first has users types only, the second has drivers and the third has admins.
My goal is to use 3 models instead one in the project I'm working on so is this a good solution and what does it cost on performance?
Upvotes: 0
Views: 60
Reputation: 142306
I suggest that it is improper to give end-users logins directly into the database. Instead, all requests should go through a database-access layer (API) that users must log into. This layer can provide the filtering you require without (perhaps) any impact to the user. The layer would, while constructing the needed SELECT
, tack on, for example, AND type = 'admin'
to achieve the goal.
For performance, you might also need to have type
at the beginning of some of the INDEXes
.
Upvotes: 0
Reputation: 174
where
clause for the views?I cannot separate this table right now because it's working on production and this is not a proper time to do this.
From what you said it sounds like a temporarily solution so it probably the good one. Later you сan replace the views with three tables and it will not affect the interface.
Upvotes: 1