悲观锁和乐观锁 pessimistic lock and optimistic lock 悲观锁:独占资源。行锁、表锁、读锁、写锁。 乐观锁:只有在提交的时候,加锁。可以使用版本号机制,用版本号辨别数据是否最新。