On Wed, 2007-03-28 at 23:42 +0530, Pavan Deolasee wrote: > > > On 3/28/07, Simon Riggs <[EMAIL PROTECTED]> wrote: > > > Set it at the end, not the beginning. > > > At the end of what ? It does not help to set it at the end of CREATE > INDEX because the transaction may not commit immediately. In > the meantime, many new transactions may start with > transaction id > xcreate. All these transactions can see the old > tuple (which we did not index) and can also see the index once > CREATE INDEX commits.
AtEOX_Reincarnate()... :-) Set xcreate to InvalidTransactionId when we build the index If we created an index in this transaction, as soon as we commit the top level transaction, run another top level transaction to set xcreate using ReadNewTransactionId(). During WAL replay, we remember any index creations and reset xcreate if we were unlucky enough to crash between the two transactions. (I'll be offline now for a few hours until the flames subside.) -- Simon Riggs EnterpriseDB http://www.enterprisedb.com ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match