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

Commitd54ca56

Browse files
committed
Install a lookaside cache to speed up repeated lookups of the same operator
by short-circuiting schema search path and ambiguous-operator resolutioncomputations. Remarkably, this buys as much as 45% speedup of repetitivesimple queries that involve operators that are not an exact match to theinput datatypes. It should be marginally faster even for exact-matchcases, though I've not had success in proving an improvement in benchmarktests. Per report from Guillame Smet and subsequent discussion.
1 parenta238bd1 commitd54ca56

File tree

3 files changed

+311
-6
lines changed

3 files changed

+311
-6
lines changed

‎src/backend/catalog/namespace.c

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Portions Copyright (c) 1994, Regents of the University of California
1414
*
1515
* IDENTIFICATION
16-
* $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.102 2007/11/25 02:09:46 tgl Exp $
16+
* $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.103 2007/11/28 18:47:56 tgl Exp $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -3006,6 +3006,40 @@ fetch_search_path(bool includeImplicit)
30063006
returnresult;
30073007
}
30083008

3009+
/*
3010+
* Fetch the active search path into a caller-allocated array of OIDs.
3011+
* Returns the number of path entries. (If this is more than sarray_len,
3012+
* then the data didn't fit and is not all stored.)
3013+
*
3014+
* The returned list always includes the implicitly-prepended namespaces,
3015+
* but never includes the temp namespace. (This is suitable for existing
3016+
* users, which would want to ignore the temp namespace anyway.) This
3017+
* definition allows us to not worry about initializing the temp namespace.
3018+
*/
3019+
int
3020+
fetch_search_path_array(Oid*sarray,intsarray_len)
3021+
{
3022+
intcount=0;
3023+
ListCell*l;
3024+
3025+
recomputeNamespacePath();
3026+
3027+
foreach(l,activeSearchPath)
3028+
{
3029+
OidnamespaceId=lfirst_oid(l);
3030+
3031+
if (namespaceId==myTempNamespace)
3032+
continue;/* do not include temp namespace */
3033+
3034+
if (count<sarray_len)
3035+
sarray[count]=namespaceId;
3036+
count++;
3037+
}
3038+
3039+
returncount;
3040+
}
3041+
3042+
30093043
/*
30103044
* Export the FooIsVisible functions as SQL-callable functions.
30113045
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp