skills:interview
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| skills:interview [2026/06/15 10:07] – [Transactions] phong2018 | skills:interview [2026/06/15 10:07] (current) – [Transactions] phong2018 | ||
|---|---|---|---|
| Line 264: | Line 264: | ||
| - How it occurs: Transactions access the same resources in different orders. Long-running transactions hold locks too long. Missing indexes cause unnecessary locking. | - How it occurs: Transactions access the same resources in different orders. Long-running transactions hold locks too long. Missing indexes cause unnecessary locking. | ||
| - How to detect it: The database detects deadlocks automatically. MySQL returns: ERROR 1213: Deadlock found when trying to get lock. Investigate with SHOW ENGINE INNODB STATUS. | - How to detect it: The database detects deadlocks automatically. MySQL returns: ERROR 1213: Deadlock found when trying to get lock. Investigate with SHOW ENGINE INNODB STATUS. | ||
| - | - How to prevent it: Keep transactions short. Always access tables/rows in a consistent order. Add proper indexes. | + | - How to prevent it: Keep transactions short. Always access tables/rows in a consistent order. Add proper indexes. Avoid large batch operations in a single transaction. |
| - | Avoid large batch operations in a single transaction. | + | |
| - How to recover: The database rolls back one transaction automatically. Catch the error in the application and retry the transaction with backoff. | - How to recover: The database rolls back one transaction automatically. Catch the error in the application and retry the transaction with backoff. | ||
| </ | </ | ||
skills/interview.1781518026.txt.gz · Last modified: by phong2018
