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

Commite9a81fb

Browse files
author
Nikita Glukhov
committed
Add GUC jsonb_sort_field_values
1 parent5df33e2 commite9a81fb

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
#include"utils/memutils.h"
3131
#include"utils/varlena.h"
3232

33-
#defineJSONB_SORTED_VALUES 1
34-
3533
/*
3634
* Maximum number of elements in an array (or key/value pairs in an object).
3735
* This is limited by two things: the size of the JEntry array must fit
@@ -137,6 +135,7 @@ static JsonbValue *fillCompressedJsonbValue(CompressedJsonb *cjb,
137135
uint32offset,JsonValue*result);
138136
staticJsonbContainer*jsonbzDecompress(JsonContainer*jc);
139137

138+
booljsonb_sort_field_values= true;/* GUC */
140139
booljsonb_partial_decompression= true;/*GUC */
141140

142141
JsonValue*
@@ -2032,7 +2031,7 @@ convertJsonbObject(StringInfo buffer, JEntry *pheader, const JsonbValue *val, in
20322031
uint32header;
20332032
intnPairs=val->val.object.nPairs;
20342033
intreserved_size;
2035-
boolsorted_values=JSONB_SORTED_VALUES&&nPairs>1;
2034+
boolsorted_values=jsonb_sort_field_values&&nPairs>1;
20362035
struct
20372036
{
20382037
intsize;

‎src/backend/utils/misc/guc.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2183,6 +2183,15 @@ static struct config_bool ConfigureNamesBool[] =
21832183
NULL,NULL,NULL
21842184
},
21852185

2186+
{
2187+
{"jsonb_sort_field_values",PGC_USERSET,DEVELOPER_OPTIONS,
2188+
gettext_noop("Use special binary jsonb format for objects when their field values sorted by length."),
2189+
},
2190+
&jsonb_sort_field_values,
2191+
true,
2192+
NULL,NULL,NULL
2193+
},
2194+
21862195
{
21872196
{"jsonb_partial_decompression",PGC_USERSET,DEVELOPER_OPTIONS,
21882197
gettext_noop("Use partial pglz decompression for jsonb."),

‎src/include/utils/jsonb.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ extern Datum jsonb_build_object_worker(int nargs, Datum *args, bool *nulls,
250250
externDatumjsonb_build_array_worker(intnargs,Datum*args,bool*nulls,
251251
Oid*types,boolabsent_on_null);
252252

253+
externbooljsonb_sort_field_values;/* GUC */
253254
externbooljsonb_partial_decompression;/* GUC */
254255

255256
#endif/* __JSONB_H__ */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp