Skip to content

Added aqo update functions. #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions aqo--1.5--1.6.sql
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,50 @@ AS 'MODULE_PATHNAME', 'aqo_cleanup'
LANGUAGE C STRICT VOLATILE;
COMMENT ON FUNCTION aqo_cleanup() IS
'Remove unneeded rows from the AQO ML storage';

--
-- Update or insert an aqo_query_texts
-- table record for given 'queryid'.
--

CREATE FUNCTION aqo_query_texts_update(
queryid bigint, query_text text)
RETURNS bool
AS 'MODULE_PATHNAME', 'aqo_query_texts_update'
LANGUAGE C VOLATILE;

--
-- Update or insert an aqo_query_stat
-- table record for given 'queryid'.
--

CREATE FUNCTION aqo_query_stat_update(
queryid bigint,
execution_time_with_aqo double precision[],
execution_time_without_aqo double precision[],
planning_time_with_aqo double precision[],
planning_time_without_aqo double precision[],
cardinality_error_with_aqo double precision[],
cardinality_error_without_aqo double precision[],
executions_with_aqo bigint,
executions_without_aqo bigint)
RETURNS bool
AS 'MODULE_PATHNAME', 'aqo_query_stat_update'
LANGUAGE C VOLATILE;

--
-- Update or insert an aqo_data
-- table record for given 'fs' & 'fss'.
--

CREATE FUNCTION aqo_data_update(
fs bigint,
fss integer,
nfeatures integer,
features double precision[][],
targets double precision[],
reliability double precision[],
oids Oid[])
RETURNS bool
AS 'MODULE_PATHNAME', 'aqo_data_update'
LANGUAGE C VOLATILE;
6 changes: 4 additions & 2 deletions auto_tuning.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,10 @@ automatical_query_tuning(uint64 queryid, StatEntry *stat)

if (num_iterations <= auto_tuning_max_iterations || p_use > 0.5)
aqo_queries_store(queryid, query_context.fspace_hash,
query_context.learn_aqo, query_context.use_aqo, true);
query_context.learn_aqo, query_context.use_aqo, true,
&aqo_queries_nulls);
else
aqo_queries_store(queryid,
query_context.fspace_hash, false, false, false);
query_context.fspace_hash, false, false, false,
&aqo_queries_nulls);
}
6 changes: 6 additions & 0 deletions expected/plancache.out
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,10 @@ SELECT * FROM f1();

DROP FUNCTION f1;
DROP TABLE test CASCADE;
SELECT true FROM aqo_reset();
bool
------
t
(1 row)

DROP EXTENSION aqo;
Loading