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

Commit433c4c6

Browse files
jeff-davispull[bot]
authored andcommitted
Remember last collation to speed up collation cache.
This optimization is to avoid a performance regression in an upcomingpatch that will remove lc_collate_is_c().Discussion:https://postgr.es/m/96a559be83329bc66074a3925ebcfa8ceb16dfc5.camel@j-davis.comDiscussion:https://postgr.es/m/646f662e145ab38cff1c04d475f4448f53fc5042.camel@j-davis.comDiscussion:https://postgr.es/m/54565933-d82f-4d7c-8f47-288b1b570fd8@eisentraut.org
1 parent2fc8815 commit433c4c6

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,13 @@ typedef struct
151151
staticMemoryContextCollationCacheContext=NULL;
152152
staticcollation_cache_hash*CollationCache=NULL;
153153

154+
/*
155+
* The collation cache is often accessed repeatedly for the same collation, so
156+
* remember the last one used.
157+
*/
158+
staticOidlast_collation_cache_oid=InvalidOid;
159+
staticpg_locale_tlast_collation_cache_locale=NULL;
160+
154161
#if defined(WIN32)&& defined(LC_MESSAGES)
155162
staticchar*IsoLocaleName(constchar*);
156163
#endif
@@ -1570,6 +1577,9 @@ pg_newlocale_from_collation(Oid collid)
15701577
if (collid==DEFAULT_COLLATION_OID)
15711578
return&default_locale;
15721579

1580+
if (last_collation_cache_oid==collid)
1581+
returnlast_collation_cache_locale;
1582+
15731583
cache_entry=lookup_collation_cache(collid);
15741584

15751585
if (cache_entry->locale==0)
@@ -1695,6 +1705,9 @@ pg_newlocale_from_collation(Oid collid)
16951705
cache_entry->locale=resultp;
16961706
}
16971707

1708+
last_collation_cache_oid=collid;
1709+
last_collation_cache_locale=cache_entry->locale;
1710+
16981711
returncache_entry->locale;
16991712
}
17001713

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp