premise
- There are two redis in our system, one permission system and one permission database
- N business systems, N business ORACLE databases
- The permission system exclusively owns a redis. The user logs in to the permission system and jumps to the business system. At this time, the business system needs to query the permission of the system to which the permission belongs. Permissions are stored in another redis. When you query again later, you only need to go to redis to get the data.
- When we query the SQL of the data: SELECT COLUMN1 ... FROM TABLE1 A WHERE A.ID IN (XXX, XXX);
problem
At first, this was very smooth. Later, I found that when the user has a data id of more than 1000, Oracle will report an error, causing the query to fail.
Solutions I already have
- Use OR, SQL: SELECT COLUMN1 ... FROM TABLE1 A WHERE A.ID IN (XXX, XXX) OR A.ID IN (XXX, XXX);
- Use UNION ALL, SQL: SELECT COLUMN1 ... FROM TABLE1 A WHERE A.ID IN (SELECT XXX FROM DUAL UNION ALL ...);
- The user's permission id is not stored in redis, but in the database. The user deletes the old data and inserts new data after each login. However, in my opinion, the solution of 1 will feel very obvious when it is actually applied. Although 2 is faster than 1, it is not beautiful and concise (in my opinion, a good code must be beautiful and concise). 3 Need to operate the database frequently, the leader does not allow it.
Is there any other better solution to this problem?