我在 RDS Aurora 上的 PostgreSQL 9.6.3 上看到了一些非常奇怪的行为。
我从某些查询中得到重复的结果:
=> select count(id) from foos where id = 'deadbeef';
count
-------
2
(1 row)
=> select id from foos where id = 'deadbeef';
id
--------------------------
deadbeef
deadbeef
(2 rows)
=> select id, created_at from foos where id = 'deadbeef';
id | created_at
--------------------------+----------------------------
deadbeef | 2018-01-01 10:00:00.000000
(1 row)
Run Code Online (Sandbox Code Playgroud)
(id 值、时间戳和表名已被混淆)
我在这张桌子或任何其他桌子上都没有桌子继承。
这似乎只影响恰好命中foos表上一个索引的查询。
因为这似乎与单个索引隔离,我想运行REINDEX 可能会解决这个问题。
但是,我不知道有多少索引表现出这种行为。
例如,这是通过不同索引对同一记录的类似行为:
=> select bar from foos where bar = 'qux';
bar
----------------------------------------- …Run Code Online (Sandbox Code Playgroud)