aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/cluster.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-12-03 05:51:03 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-12-03 05:51:03 +0000
commita98871b7ac601b4ebe6ba050b1f9cbfdd5d71ded (patch)
tree14a0b7c6a91cf05fc5556a6dcb00246ff11b0e6a /src/backend/commands/cluster.c
parent1cf65140d07527e01c56164caefb5eb0c8106480 (diff)
downloadpostgresql-a98871b7ac601b4ebe6ba050b1f9cbfdd5d71ded.tar.gz
postgresql-a98871b7ac601b4ebe6ba050b1f9cbfdd5d71ded.zip
Tweak indexscan machinery to avoid taking an AccessShareLock on an index
if we already have a stronger lock due to the index's table being the update target table of the query. Same optimization I applied earlier at the table level. There doesn't seem to be much interest in the more radical idea of not locking indexes at all, so do what we can ...
Diffstat (limited to 'src/backend/commands/cluster.c')
-rw-r--r--src/backend/commands/cluster.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 671c8bf091e..e97cc83669f 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.142 2005/11/22 18:17:08 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.143 2005/12/03 05:51:01 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -643,7 +643,8 @@ copy_heap_data(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex)
* Scan through the OldHeap on the OldIndex and copy each tuple into the
* NewHeap.
*/
- scan = index_beginscan(OldHeap, OldIndex, SnapshotNow, 0, (ScanKey) NULL);
+ scan = index_beginscan(OldHeap, OldIndex, true,
+ SnapshotNow, 0, (ScanKey) NULL);
while ((tuple = index_getnext(scan, ForwardScanDirection)) != NULL)
{