Unlike traditional database systems which use locks for concurrency control, Greenplum Database (as does PostgreSQL) maintains data consistency by using a multiversion model (Multiversion Concurrency Control, MVCC). This means that while querying a database,
each transaction sees a snapshot of data which protects the transaction from viewing inconsistent data that could be caused by (other) concurrent updates on the same data rows. This provides transaction isolation for each database session.
MVCC, by eschewing explicit locking methodologies of traditional database systems, minimizes lock contention in order to allow for reasonable performance in multiuser environments. The main advantage to using the MVCC model of concurrency control rather than
locking is that in MVCC locks acquired for querying (reading) data do not conflict with locks acquired for writing data, and so reading never blocks writing and writing never blocks reading.
Greenplum Database provides various lock modes to control concurrent access to data in tables. Most Greenplum Database SQL commands automatically acquire locks of appropriate modes to ensure that referenced tables are not dropped or modified in incompatible
ways while the command executes. For applications that cannot adapt easily to MVCC behavior, the LOCK command can be used to acquire explicit locks. However, proper use of MVCC will generally provide better performance than locks.
Concurrency Control in Greenplum Database
最新推荐文章于 2024-07-09 18:56:35 发布
Greenplum数据库通过采用多版本并发控制(MVCC)模型,确保了每个数据库会话的数据隔离,同时避免了传统数据库系统中锁竞争导致的性能瓶颈。该文详细解释了MVCC如何在不引入锁的情况下实现并发读写操作,显著提升了多用户环境下的性能。
4063

被折叠的 条评论
为什么被折叠?



