После оптимизации PostgreSQL запрос стал быстрее, но интеграционный тест иногда возвращает транзакции другого пользователя. До релиза один день, а исправление затрагивает фильтр Django ORM. Что выберешь первым: выпускать ускорение или остановиться на проверке корректности?
Asked at
AI answer
First, stop the release until correctness has been verified. A query that sometimes returns another user's transactions can cause a data leak; making it faster does not make up for that. Reproduce the problem, check the owner-based filtering and the generated SQL, add a regression test for user isolation, and make sure the fix is safe. If it cannot be done on time, revert the optimization or postpone the release rather than shipping a questionable filter.
Also asked at ylab
- Could you tell me about your overall role in this project? Were you fully responsible for it, or were you responsible for a specific part?
- Could you tell about a situation where you made a mistake at work?
- How can you find and analyze slow queries in PostgreSQL?
- 20. Valid Parentheses Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: 1. Open brackets must be closed by the same type of brackets. 2. Open brackets must be closed in the correct order. 3. Every close bracket has a corresponding open bracket of the same type. Example 1: Input: s = "()" Output: true Example 2: Input: s = "()[]{}" Output: true Example 3: Input: s = "(]" Output: false
Similar questions
- You’ve deployed a release. The service hasn’t gone down, but its response time has risen sharply (from 200 ms to 2 s). What would you do, and where would you look first?
- If the problem turns out to be on the database side and a SELECT query is taking a long time, what would you do? Which columns are indexes usually created on?
- If a service or method takes a long time to run, the problem could be with the Python script or the database. How would you figure out where the slowdown is occurring?
- Did you work directly with PostgreSQL or through ORM?
- Is it possible to execute SQL queries directly in Django without using ORM?