Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite02d1ab

Browse files
committed
During swap_relfilenodes, swap relation size statistic fields along with
the relfilenode and toast fields. This ensures that the newly-computedstatistics will be available on completion of CLUSTER.
1 parent5123139 commite02d1ab

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

‎src/backend/commands/cluster.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.90 2002/09/0420:31:14 momjian Exp $
14+
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.91 2002/11/02 21:20:40 tgl Exp $
1515
*
1616
*-------------------------------------------------------------------------
1717
*/
@@ -475,6 +475,20 @@ swap_relfilenodes(Oid r1, Oid r2)
475475

476476
/* we should not swap reltoastidxid */
477477

478+
/* swap size statistics too, since new rel has freshly-updated stats */
479+
{
480+
int4swap_pages;
481+
float4swap_tuples;
482+
483+
swap_pages=relform1->relpages;
484+
relform1->relpages=relform2->relpages;
485+
relform2->relpages=swap_pages;
486+
487+
swap_tuples=relform1->reltuples;
488+
relform1->reltuples=relform2->reltuples;
489+
relform2->reltuples=swap_tuples;
490+
}
491+
478492
/* Update the tuples in pg_class */
479493
simple_heap_update(relRelation,&reltup1->t_self,reltup1);
480494
simple_heap_update(relRelation,&reltup2->t_self,reltup2);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp