并发值修改会影响PostgreSQL 9.1中的单选吗?

考虑在Postgresql 9.1(或9.2)中执行的以下查询
SELECT * FROM foo WHERE bar = true

假设这是一个相当长时间运行的查询(例如花一分钟).

如果在查询开始时有500万条记录,其中bar = true,则在另一个事务中的查询期间,在foo表中添加删除行,对于某些现有行,对条形字段进行更新.

这会影响上面显示的选择查询的结果吗?

我知道单个事务中单独语句之间的事务隔离和可见性,但是正在运行的单个语句呢?

没有.
由于MVCC模型,只有在查询开始时可见的元组才会在单个SELECT中使用.手册 here中的详细信息:

Read Committed is the default isolation level in Postgresql. When a
transaction uses this isolation level,a SELECT query (without a FOR
UPDATE/SHARE clause) sees only data committed before the query began;
it never sees either uncommitted data or changes committed during
query execution by concurrent transactions
. In effect,a SELECT query
sees a snapshot of the database as of the instant the query begins to
run. However,SELECT does see the effects of prevIoUs updates executed
within its own transaction,even though they are not yet committed.
Also note that two successive SELECT commands can see different data,
even though they are within a single transaction,if other
transactions commit changes during execution of the first SELECT.

强调我的.

相关文章

项目需要,有个数据需要导入,拿到手一开始以为是mysql,结果...
本文小编为大家详细介绍“怎么查看PostgreSQL数据库中所有表...
错误现象问题原因这是在远程连接时pg_hba.conf文件没有配置正...
因本地资源有限,在公共测试环境搭建了PGsql环境,从数据库本...
wamp 环境 这个提示就是说你的版本低于10了。 先打印ph...
psycopg2.OperationalError: SSL SYSCALL error: EOF detect...