8000 set max size 1000 · postgrespro/aqo@4d3a687 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4d3a687

Browse files
Andrey KazarinovAlena Rybakina
Andrey Kazarinov
authored and
Alena Rybakina
committed
set max size 1000
1 parent 7a03aa5 commit 4d3a687

File tree

4 files changed

+16
-0
lines changed

4 files changed

+16
-0
lines changed

aqo.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,19 @@ _PG_init(void)
238238
NULL
239239
);
240240

241+
DefineCustomIntVariable("aqo.max_size",
242+
"Query max size in aqo_query_texts.",
243+
NULL,
244+
&max_size,
245+
1000,
246+
0, INT_MAX,
247+
PGC_SUSET,
248+
0,
249+
NULL,
250+
NULL,
251+
NULL
252+
);
253+
241254
prev_shmem_startup_hook = shmem_startup_hook;
242255
shmem_startup_hook = aqo_init_shmem;
243256
prev_planner_hook = planner_hook;

aqo_shared.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ HTAB *fss_htab = NULL;
2828
static int aqo_htab_max_items = 1000;
2929
int fs_max_items = 1; /* Max number of different feature spaces in ML model */
3030
int fss_max_items = 1; /* Max number of different feature subspaces in ML model */
31+
int max_size = 1000;
3132
static uint32 temp_storage_size = 1024 * 1024 * 10; /* Storage size, in bytes */
3233
static dsm_segment *seg = NULL;
3334

aqo_shared.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ extern HTAB *fss_htab;
5252

5353
extern int fs_max_items; /* Max number of feature spaces that AQO can operate */
5454
extern int fss_max_items;
55+
extern int max_size;
5556

5657
extern Size aqo_memsize(void);
5758
extern void reset_dsm_cache(void);

storage.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,7 @@ aqo_qtext_store(uint64 queryid, const char *query_string)
969969
}
970970

971971
entry->queryid = queryid;
972+
size = size > max_size ? max_size : size;
972973
entry->qtext_dp = dsa_allocate(qtext_dsa, size);
973974
Assert(DsaPointerIsValid(entry->qtext_dp));
974975
strptr = (char *) dsa_get_address(qtext_dsa, entry->qtext_dp);

0 commit comments

Comments
 (0)
0