diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
new file mode 100644
index b3dac51..cff96f7
*** a/src/backend/utils/misc/guc.c
--- b/src/backend/utils/misc/guc.c
***************
*** 106,111 ****
--- 106,112 ----
  /* XXX these should appear in other modules' header files */
  extern bool Log_disconnections;
  extern int	CommitDelay;
+ extern int	JJ_SNAP;
  extern int	CommitSiblings;
  extern char *default_tablespace;
  extern char *temp_tablespaces;
*************** static struct config_int ConfigureNamesI
*** 2264,2269 ****
--- 2265,2280 ----
  	},
  
  	{
+ 		{"JJ_SNAP", PGC_USERSET, LOCK_MANAGEMENT,
+ 			gettext_noop("change MVCC order of tests"
+ 						 ""),
+ 			NULL
+ 		},
+ 		&JJ_SNAP,
+ 		0, 0, 100000,
+ 		NULL, NULL, NULL
+ 	},
+ 	{
  		{"commit_delay", PGC_SUSET, WAL_SETTINGS,
  			gettext_noop("Sets the delay in microseconds between transaction commit and "
  						 "flushing WAL to disk."),
diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c
new file mode 100644
index de7b3fc..3a49dda
*** a/src/backend/utils/time/tqual.c
--- b/src/backend/utils/time/tqual.c
***************
*** 69,74 ****
--- 69,76 ----
  #include "utils/tqual.h"
  
  
+ int JJ_SNAP=0;
+ 
  /* Static variables representing various special snapshot semantics */
  SnapshotData SnapshotSelfData = {HeapTupleSatisfiesSelf};
  SnapshotData SnapshotAnyData = {HeapTupleSatisfiesAny};
*************** HeapTupleSatisfiesMVCC(HeapTuple htup, S
*** 945,950 ****
--- 947,954 ----
  					   Buffer buffer)
  {
  	HeapTupleHeader tuple = htup->t_data;
+ 	bool checked_snapshot_xmin=false;
+ 	bool checked_snapshot_xmax=false;
  
  	Assert(ItemPointerIsValid(&htup->t_self));
  	Assert(htup->t_tableOid != InvalidOid);
*************** HeapTupleSatisfiesMVCC(HeapTuple htup, S
*** 1035,1040 ****
--- 1039,1047 ----
  			else
  				return false;	/* deleted before scan started */
  		}
+ 		else if (JJ_SNAP && (checked_snapshot_xmin=true) && !HeapTupleHeaderXminFrozen(tuple)
+ 				&& XidInMVCCSnapshot(HeapTupleHeaderGetRawXmin(tuple), snapshot))
+ 			return false;
  		else if (TransactionIdIsInProgress(HeapTupleHeaderGetRawXmin(tuple)))
  			return false;
  		else if (TransactionIdDidCommit(HeapTupleHeaderGetRawXmin(tuple)))
*************** HeapTupleSatisfiesMVCC(HeapTuple htup, S
*** 1053,1059 ****
  	 * By here, the inserting transaction has committed - have to check
  	 * when...
  	 */
! 	if (!HeapTupleHeaderXminFrozen(tuple)
  		&& XidInMVCCSnapshot(HeapTupleHeaderGetRawXmin(tuple), snapshot))
  		return false;			/* treat as still in progress */
  
--- 1060,1066 ----
  	 * By here, the inserting transaction has committed - have to check
  	 * when...
  	 */
! 	if (!checked_snapshot_xmin && !HeapTupleHeaderXminFrozen(tuple)
  		&& XidInMVCCSnapshot(HeapTupleHeaderGetRawXmin(tuple), snapshot))
  		return false;			/* treat as still in progress */
  
*************** HeapTupleSatisfiesMVCC(HeapTuple htup, S
*** 1105,1110 ****
--- 1112,1120 ----
  				return false;	/* deleted before scan started */
  		}
  
+ 		if (JJ_SNAP && (checked_snapshot_xmax=true) && XidInMVCCSnapshot(HeapTupleHeaderGetRawXmax(tuple), snapshot))
+ 			return true;
+ 
  		if (TransactionIdIsInProgress(HeapTupleHeaderGetRawXmax(tuple)))
  			return true;
  
*************** HeapTupleSatisfiesMVCC(HeapTuple htup, S
*** 1124,1130 ****
  	/*
  	 * OK, the deleting transaction committed too ... but when?
  	 */
! 	if (XidInMVCCSnapshot(HeapTupleHeaderGetRawXmax(tuple), snapshot))
  		return true;			/* treat as still in progress */
  
  	return false;
--- 1134,1140 ----
  	/*
  	 * OK, the deleting transaction committed too ... but when?
  	 */
! 	if (!checked_snapshot_xmax && XidInMVCCSnapshot(HeapTupleHeaderGetRawXmax(tuple), snapshot))
  		return true;			/* treat as still in progress */
  
  	return false;
