mirror of
https://github.com/postgres/postgres.git
synced 2025-04-22 23:02:54 +03:00
During swap_relfilenodes, swap relation size statistic fields along with
the relfilenode and toast fields. This ensures that the newly-computed statistics will be available on completion of CLUSTER.
This commit is contained in:
parent
5123139210
commit
e02d1abee6
@ -11,7 +11,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.90 2002/09/04 20:31:14 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.91 2002/11/02 21:20:40 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -475,6 +475,20 @@ swap_relfilenodes(Oid r1, Oid r2)
|
|||||||
|
|
||||||
/* we should not swap reltoastidxid */
|
/* we should not swap reltoastidxid */
|
||||||
|
|
||||||
|
/* swap size statistics too, since new rel has freshly-updated stats */
|
||||||
|
{
|
||||||
|
int4 swap_pages;
|
||||||
|
float4 swap_tuples;
|
||||||
|
|
||||||
|
swap_pages = relform1->relpages;
|
||||||
|
relform1->relpages = relform2->relpages;
|
||||||
|
relform2->relpages = swap_pages;
|
||||||
|
|
||||||
|
swap_tuples = relform1->reltuples;
|
||||||
|
relform1->reltuples = relform2->reltuples;
|
||||||
|
relform2->reltuples = swap_tuples;
|
||||||
|
}
|
||||||
|
|
||||||
/* Update the tuples in pg_class */
|
/* Update the tuples in pg_class */
|
||||||
simple_heap_update(relRelation, &reltup1->t_self, reltup1);
|
simple_heap_update(relRelation, &reltup1->t_self, reltup1);
|
||||||
simple_heap_update(relRelation, &reltup2->t_self, reltup2);
|
simple_heap_update(relRelation, &reltup2->t_self, reltup2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user