On Tue, Mar 14, 2017 at 12:19 PM, Alvaro Herrera <alvhe...@2ndquadrant.com> wrote: > Impressive results.
Agreed. It seems like an important invariant for WARM is that any duplicate index values ought to have different TIDs (actually, it's a bit stricter than that, since btrecheck() cares about simple binary equality). ISTM that it would be fairly easy to modify amcheck such that the "items in logical order" check, as well as the similar "cross-page order" check (the one that detects transposed pages) also check that this new WARM invariant holds. Obviously this would only make sense on the leaf level of the index. You wouldn't have to teach amcheck about the heap, because a TID that points to the heap can only be duplicated within a B-Tree index because of WARM. So, if we find that two adjacent tuples are equal, check if the TIDs are equal. If they are also equal, check for strict binary equality. If strict binary equality is indicated, throw an error due to invariant failing. IIUC, the design of WARM makes this simple enough to implement, and cheap enough that the additional runtime overhead is well worthwhile. You could just add this check to the existing checks without changing the user-visible interface. It seems pretty complementary to what is already there. -- Peter Geoghegan -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers