You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: aqo--1.4--1.5.sql
+36Lines changed: 36 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -77,6 +77,7 @@ END;
77
77
$$ LANGUAGE plpgsql;
78
78
79
79
DROPFUNCTIONpublic.top_time_queries;
80
+
DROPFUNCTIONpublic.aqo_drop;
80
81
81
82
--
82
83
-- Show execution time of queries, for which AQO has statistics.
@@ -131,3 +132,38 @@ $$ LANGUAGE plpgsql;
131
132
132
133
COMMENT ON FUNCTION public.show_execution_time(boolean) IS
133
134
'Get execution time of queries. If controlled = true (AQO could advise cardinality estimations), show time of last execution attempt. Another case (AQO not used), return an average value of execution time across all known executions.';
135
+
136
+
CREATE OR REPLACEFUNCTIONpublic.aqo_drop_class(idbigint)
137
+
RETURNSintegerAS $$
138
+
DECLARE
139
+
fsbigint;
140
+
numinteger;
141
+
BEGIN
142
+
IF (id=0) THEN
143
+
raise EXCEPTION'[AQO] Cannot remove basic class %.', id;
144
+
END IF;
145
+
146
+
SELECT fspace_hashFROMpublic.aqo_queriesWHERE (query_hash= id) INTO fs;
147
+
148
+
IF (fs ISNULL) THEN
149
+
raise WARNING'[AQO] Nothing to remove for the class %.', id;
150
+
RETURN0;
151
+
END IF;
152
+
153
+
IF (fs<> id) THEN
154
+
raise WARNING'[AQO] Removing query class has non-generic feature space value: id = %, fs = %.', id, fs;
155
+
END IF;
156
+
157
+
SELECTcount(*)FROMpublic.aqo_dataWHERE fspace_hash= fs INTO num;
158
+
159
+
/*
160
+
* Remove the only from aqo_queries table. All other data will be removed by
161
+
* CASCADE deletion.
162
+
*/
163
+
DELETEFROMpublic.aqo_queriesWHERE query_hash= id;
164
+
RETURN num;
165
+
END;
166
+
$$ LANGUAGE plpgsql;
167
+
168
+
COMMENT ON FUNCTION public.aqo_drop_class(bigint) IS
169
+
'Remove info about an query class from AQO ML knowledge base.';
Get execution time of queries. If controlled = true (AQO could advise cardinality estimations), show time of last execution attempt. Another case (AQO not used), return an average value of execution time across all known executions.