0

One database. N tables. In each table we have column (ex. "user"). ~1000 users.

We have to isolate data for each user from another users. How to do it? The most common solution is use queries like SELECT * FROM TABLE_NAME WHERE USER = 3. But the queries became more complex and the chance to make a mistake is growing.

Is there the way to do it on the level of database? I prefer to use MySQL, but if the best solution exists, I'm gonna use it.

P.S. it is impossible to create separate DB for each user.

1737973
  • 159
  • 18
  • 42
Mateil
  • 1
  • 2
    For application users there isn't a good native way of dealing it in MySQL.. For [MySQL users](https://www.sqlmaestro.com/resources/all/row_level_security_mysql/) on the other hand.. – Raymond Nijland Sep 10 '19 at 10:06
  • 2
    Consider changing RDMS PostgreSQL 11 has native support for this problem .. See [CREATE POLICY](https://www.postgresql.org/docs/11/sql-createpolicy.html) , with RDMS user support and expression support meaning you can also create them for application users. – Raymond Nijland Sep 10 '19 at 10:56
  • Thank you, sir! I hope it will help/ – Mateil Sep 10 '19 at 16:18

0 Answers0