Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a3cbc10

Browse files
author
Alexandra Pervushina
committed
Change htab keys to contain dbid
1 parent 2108020 commit a3cbc10

File tree

4 files changed

+188
-123
lines changed

4 files changed

+188
-123
lines changed

aqo--1.6.sql

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,13 @@ CREATE FUNCTION aqo_reset() RETURNS bigint
150150
AS 'MODULE_PATHNAME', 'aqo_reset'
151151
LANGUAGE C PARALLEL SAFE;
152152
COMMENT ON FUNCTION aqo_reset() IS
153-
'Reset all data gathered by AQO';
153+
'Reset all data gathered by AQO for the current database';
154+
155+
CREATE FUNCTION aqo_reset(dbid oid) RETURNS bigint
156+
AS 'MODULE_PATHNAME', 'aqo_reset'
157+
LANGUAGE C PARALLEL SAFE;
158+
COMMENT ON FUNCTION aqo_reset(oid) IS
159+
'Reset all data gathered by AQO for the specified database';
154160

155161
-- -----------------------------------------------------------------------------
156162
--
@@ -161,7 +167,6 @@ COMMENT ON FUNCTION aqo_reset() IS
161167
CREATE FUNCTION aqo_data (
162168
OUT fs bigint,
163169
OUT fss integer,
164-
OUT db_id Oid,
165170
OUT nfeatures integer,
166171
OUT features double precision[][],
167172
OUT targets double precision[],
@@ -174,7 +179,6 @@ LANGUAGE C STRICT VOLATILE PARALLEL SAFE;
174179

175180
CREATE FUNCTION aqo_queries (
176181
OUT queryid bigint,
177-
OUT db_id Oid,
178182
OUT fs bigint,
179183
OUT learn_aqo boolean,
180184
OUT use_aqo boolean,
@@ -188,7 +192,6 @@ LANGUAGE C STRICT VOLATILE PARALLEL SAFE;
188192

189193
CREATE FUNCTION aqo_query_stat (
190194
OUT queryid bigint,
191-
OUT db_id Oid,
192195
OUT execution_time_with_aqo double precision[],
193196
OUT execution_time_without_aqo double precision[],
194197
OUT planning_time_with_aqo double precision[],
@@ -202,7 +205,7 @@ RETURNS SETOF record
202205
AS 'MODULE_PATHNAME', 'aqo_query_stat'
203206
LANGUAGE C STRICT VOLATILE PARALLEL SAFE;
204207

205-
CREATE FUNCTION aqo_query_texts(OUT queryid bigint, OUT dbid Oid, OUT query_text text)
208+
CREATE FUNCTION aqo_query_texts(OUT queryid bigint, OUT query_text text)
206209
RETURNS SETOF record
207210
AS 'MODULE_PATHNAME', 'aqo_query_texts'
208211
LANGUAGE C STRICT VOLATILE PARALLEL SAFE;

aqo_shared.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,14 @@ aqo_init_shmem(void)
6060
LWLockInitialize(&aqo_state->queries_lock, LWLockNewTrancheId());
6161
}
6262

63-
info.keysize = sizeof(((StatEntry *) 0)->queryid);
63+
info.keysize = sizeof(stat_key);
64+
elog(LOG, "keysize %ld", info.keysize);
6465
info.entrysize = sizeof(StatEntry);
6566
stat_htab = ShmemInitHash("AQO Stat HTAB", fs_max_items, fs_max_items,
6667
&info, HASH_ELEM | HASH_BLOBS);
6768

6869
/* Init shared memory table for query texts */
69-
info.keysize = sizeof(((QueryTextEntry *) 0)->queryid);
70+
info.keysize = sizeof(qtext_key);
7071
info.entrysize = sizeof(QueryTextEntry);
7172
qtexts_htab = ShmemInitHash("AQO Query Texts HTAB", fs_max_items, fs_max_items,
7273
&info, HASH_ELEM | HASH_BLOBS);
@@ -78,7 +79,7 @@ aqo_init_shmem(void)
7879
&info, HASH_ELEM | HASH_BLOBS);
7980

8081
/* Shared memory hash table for queries */
81-
info.keysize = sizeof(((QueriesEntry *) 0)->queryid);
82+
info.keysize = sizeof(queries_key);
8283
info.entrysize = sizeof(QueriesEntry);
8384
queries_htab = ShmemInitHash("AQO Queries HTAB", fs_max_items, fs_max_items,
8485
&info, HASH_ELEM | HASH_BLOBS);

0 commit comments

Comments
 (0)