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

Commit922e53e

Browse files
committed
Enable pg_statistic cache use.
1 parent8f401e8 commit922e53e

File tree

4 files changed

+25
-21
lines changed

4 files changed

+25
-21
lines changed

‎src/backend/catalog/indexing.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.52 1999/11/24 16:52:31 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.53 1999/11/25 00:15:56 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -63,6 +63,8 @@ char *Name_pg_rewrite_indices[Num_pg_rewrite_indices] =
6363
{RewriteOidIndex,RewriteRulenameIndex};
6464
char*Name_pg_shadow_indices[Num_pg_shadow_indices]=
6565
{ShadowNameIndex,ShadowSysidIndex};
66+
char*Name_pg_statistic_indices[Num_pg_statistic_indices]=
67+
{StatisticRelidAttnumOpIndex};
6668
char*Name_pg_trigger_indices[Num_pg_trigger_indices]=
6769
{TriggerRelidIndex,TriggerConstrNameIndex,TriggerConstrRelidIndex};
6870
char*Name_pg_type_indices[Num_pg_type_indices]=

‎src/backend/commands/rename.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.36 1999/11/24 00:44:30 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/rename.c,v 1.37 1999/11/25 00:15:57 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -56,7 +56,6 @@ renameatt(char *relname,
5656
HeapTuplereltup,
5757
oldatttup,
5858
newatttup;
59-
Relationirelations[Num_pg_attr_indices];
6059
Oidrelid;
6160

6261
/*
@@ -159,10 +158,13 @@ renameatt(char *relname,
159158
heap_update(attrelation,&oldatttup->t_self,oldatttup,NULL);
160159

161160
/* keep system catalog indices current */
162-
CatalogOpenIndices(Num_pg_attr_indices,Name_pg_attr_indices,irelations);
163-
CatalogIndexInsert(irelations,Num_pg_attr_indices,attrelation,oldatttup);
164-
CatalogCloseIndices(Num_pg_attr_indices,irelations);
165-
161+
{
162+
Relationirelations[Num_pg_attr_indices];
163+
CatalogOpenIndices(Num_pg_attr_indices,Name_pg_attr_indices,irelations);
164+
CatalogIndexInsert(irelations,Num_pg_attr_indices,attrelation,oldatttup);
165+
CatalogCloseIndices(Num_pg_attr_indices,irelations);
166+
}
167+
166168
pfree(oldatttup);
167169
heap_close(attrelation,RowExclusiveLock);
168170
}

‎src/backend/commands/vacuum.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.125 1999/11/22 17:56:02 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.126 1999/11/25 00:15:57 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -24,6 +24,7 @@
2424
#include"catalog/catalog.h"
2525
#include"catalog/catname.h"
2626
#include"catalog/index.h"
27+
#include"catalog/indexing.h"
2728
#include"catalog/pg_operator.h"
2829
#include"catalog/pg_statistic.h"
2930
#include"catalog/pg_type.h"
@@ -2446,6 +2447,13 @@ vc_updstats(Oid relid, int num_pages, int num_tuples, bool hasindex, VRelStats *
24462447
*/
24472448
heap_insert(sd,stup);
24482449

2450+
{
2451+
Relationirelations[Num_pg_statistic_indices];
2452+
CatalogOpenIndices(Num_pg_statistic_indices,Name_pg_statistic_indices,irelations);
2453+
CatalogIndexInsert(irelations,Num_pg_statistic_indices,sd,stup);
2454+
CatalogCloseIndices(Num_pg_statistic_indices,irelations);
2455+
}
2456+
24492457
/* release allocated space */
24502458
pfree(DatumGetPointer(values[Anum_pg_statistic_stacommonval-1]));
24512459
pfree(DatumGetPointer(values[Anum_pg_statistic_staloval-1]));

‎src/backend/utils/adt/selfuncs.c

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.42 1999/11/22 17:56:30 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.43 1999/11/25 00:15:57 momjian Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -588,27 +588,20 @@ getattstatistics(Oid relid, AttrNumber attnum, Oid typid, int32 typmod,
588588
Datum*hival)
589589
{
590590
Relationrel;
591-
HeapScanDescscan;
592-
staticScanKeyDatakey[2]= {
593-
{0,Anum_pg_statistic_starelid,F_OIDEQ, {0,0,F_OIDEQ}},
594-
{0,Anum_pg_statistic_staattnum,F_INT2EQ, {0,0,F_INT2EQ}}
595-
};
596591
boolisnull;
597592
HeapTupletuple;
598593
HeapTupletypeTuple;
599594
FmgrInfoinputproc;
600595

601596
rel=heap_openr(StatisticRelationName,AccessShareLock);
602597

603-
key[0].sk_argument=ObjectIdGetDatum(relid);
604-
key[1].sk_argument=Int16GetDatum((int16)attnum);
605-
606-
scan=heap_beginscan(rel,0,SnapshotNow,2,key);
607-
tuple=heap_getnext(scan,0);
598+
tuple=SearchSysCacheTuple(STATRELID,
599+
ObjectIdGetDatum(relid),
600+
Int16GetDatum((int16)attnum),
601+
0,0);/* staop is currently 0 */
608602
if (!HeapTupleIsValid(tuple))
609603
{
610604
/* no such stats entry */
611-
heap_endscan(scan);
612605
heap_close(rel,AccessShareLock);
613606
return false;
614607
}
@@ -693,7 +686,6 @@ getattstatistics(Oid relid, AttrNumber attnum, Oid typid, int32 typmod,
693686
}
694687
}
695688

696-
heap_endscan(scan);
697689
heap_close(rel,AccessShareLock);
698690
return true;
699691
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp