Re: CREATE INDEX and HOT - revised design - Mailing list pgsql-hackers

From Pavan Deolasee
Subject Re: CREATE INDEX and HOT - revised design
Date
Msg-id 460D3869.5010907@enterprisedb.com
Whole thread Raw
In response to Re: CREATE INDEX and HOT - revised design  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: CREATE INDEX and HOT - revised design  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:>> I'm getting tired of repeating this, but: the planner doesn't use a> snapshot.  System catalogs run
onSnapshotNow.>
 

I am really sorry if I sound foolish here. I am NOT suggesting
that we use "snapshot" to read system catalogs. I understand
that system catalogs run on SnapshotNow and all transactions,
irrespective of when they started, would see the changes to
system catalogs as soon as the transaction updating the
system catalog commits.

What I am suggesting is to use ActiveSnapshot (actually
Florian's idea) to decide whether the transaction that created
index was still running when we started. Isn't it the case that
some snapshot will be "active" when we plan ? The active
snapshot may change later in the same transaction if we
are running in read-committed mode, and we may need to
invalidate the plan.

Here is what I suggest to do in get_relation_info():

+    if (index->indcreatexid != InvalidTransactionId)
+    {
+        Assert(ActiveSnapshot);
+        if (XidInMVCCSnapshot(index->indcreatexid, ActiveSnapshot))
+        {
+            index_close(indexRelation, NoLock);
+            continue;
+        }
+        /*
+         * Otherwise the index is usable
+         */
+    }


Is there a problem with this ?

I really appreciate all the help I am receiving on this. But
there is hardly anything else that I can do than post my
thoughts and get feedback, until we find a clean solution :-(

Thanks,
Pavan


-- 


EnterpriseDB        http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: CREATE INDEX and HOT - revised design
Next
From: "Florian G. Pflug"
Date:
Subject: Re: CREATE INDEX and HOT - revised design