Skip to content

Commit 60dc4e6

Browse files
committed
Remove aqo_reset_query until we realize it is necessary.
Now we are on a way to relocatability and this function must be rewrited or removed. So far we haven't used it - maybe it have a bad design? Also fix regression tests unstability - rows reordering issue.
1 parent e788c57 commit 60dc4e6

File tree

7 files changed

+12
-48
lines changed

7 files changed

+12
-48
lines changed

aqo--1.4--1.5.sql

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -208,33 +208,6 @@ $$ LANGUAGE plpgsql;
208208
COMMENT ON FUNCTION aqo_cardinality_error(boolean) IS
209209
'Get cardinality error of queries the last time they were executed. Order queries according to an error value.';
210210

211-
--
212-
-- Remove all learning data for query with given ID.
213-
-- Can be used in the case when user don't want to drop preferences and
214-
-- accumulated statistics on a query class, but tries to re-learn AQO on this
215-
-- class.
216-
-- Returns a number of deleted rows in the aqo_data table.
217-
--
218-
CREATE OR REPLACE FUNCTION aqo_reset_query(queryid_res bigint)
219-
RETURNS integer AS $$
220-
DECLARE
221-
num integer;
222-
lfs bigint;
223-
BEGIN
224-
IF (queryid_res = 0) THEN
225-
raise WARNING '[AQO] Reset common feature space.'
226-
END IF;
227-
228-
SELECT fs FROM aqo_queries WHERE queryid = queryid_res INTO lfs;
229-
SELECT count(*) FROM aqo_data WHERE fs = lfs INTO num;
230-
DELETE FROM aqo_data WHERE fs = lfs;
231-
RETURN num;
232-
END;
233-
$$ LANGUAGE plpgsql;
234-
235-
COMMENT ON FUNCTION aqo_reset_query(bigint) IS
236-
'Remove from AQO storage only learning data for given QueryId.';
237-
238211
CREATE FUNCTION aqo_status(hash bigint)
239212
RETURNS TABLE (
240213
"learn" BOOL,

expected/forced_stat_collection.out

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ SELECT * FROM aqo_data;
4040

4141
SELECT learn_aqo,use_aqo,auto_tuning,cardinality_error_without_aqo ce,executions_without_aqo nex
4242
FROM aqo_queries AS aq JOIN aqo_query_stat AS aqs
43-
ON aq.queryid = aqs.queryid;
43+
ON aq.queryid = aqs.queryid
44+
ORDER BY (cardinality_error_without_aqo);
4445
learn_aqo | use_aqo | auto_tuning | ce | nex
4546
-----------+---------+-------------+----------------------+-----
4647
f | f | f | {0.8637762840285226} | 1

expected/gucs.out

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,6 @@ SELECT obj_description('aqo_cleanup'::regproc::oid);
6262
Remove unneeded rows from the AQO ML storage
6363
(1 row)
6464

65-
SELECT obj_description('aqo_reset_query'::regproc::oid);
66-
obj_description
67-
---------------------------------------------------------------
68-
Remove from AQO storage only learning data for given QueryId.
69-
(1 row)
70-
7165
SELECT obj_description('aqo_reset'::regproc::oid);
7266
obj_description
7367
--------------------------------
@@ -102,13 +96,6 @@ SELECT obj_description('aqo_reset'::regproc::oid);
10296
public | aqo_cleanup | record | OUT nfs integer, OUT nfss integer | func
10397
(1 row)
10498

105-
\df aqo_reset_query
106-
List of functions
107-
Schema | Name | Result data type | Argument data types | Type
108-
--------+-----------------+------------------+---------------------+------
109-
public | aqo_reset_query | integer | queryid_res bigint | func
110-
(1 row)
111-
11299
\df aqo_reset
113100
List of functions
114101
Schema | Name | Result data type | Argument data types | Type

expected/relocatable.out

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ SELECT aqo_disable_query(id) FROM (
8888

8989
(2 rows)
9090

91-
SELECT learn_aqo, use_aqo, auto_tuning FROM test.aqo_queries;
91+
SELECT learn_aqo, use_aqo, auto_tuning FROM test.aqo_queries
92+
ORDER BY (learn_aqo, use_aqo, auto_tuning);
9293
learn_aqo | use_aqo | auto_tuning
9394
-----------+---------+-------------
9495
f | f | f
@@ -104,7 +105,8 @@ SELECT aqo_enable_query(id) FROM (
104105

105106
(2 rows)
106107

107-
SELECT learn_aqo, use_aqo, auto_tuning FROM test.aqo_queries;
108+
SELECT learn_aqo, use_aqo, auto_tuning FROM test.aqo_queries
109+
ORDER BY (learn_aqo, use_aqo, auto_tuning);
108110
learn_aqo | use_aqo | auto_tuning
109111
-----------+---------+-------------
110112
f | f | f

sql/forced_stat_collection.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ SELECT * FROM aqo_data;
3232

3333
SELECT learn_aqo,use_aqo,auto_tuning,cardinality_error_without_aqo ce,executions_without_aqo nex
3434
FROM aqo_queries AS aq JOIN aqo_query_stat AS aqs
35-
ON aq.queryid = aqs.queryid;
35+
ON aq.queryid = aqs.queryid
36+
ORDER BY (cardinality_error_without_aqo);
3637

3738
SELECT query_text FROM aqo_query_texts ORDER BY (md5(query_text));
3839

sql/gucs.sql

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,12 @@ SELECT obj_description('aqo_cardinality_error'::regproc::oid);
2121
SELECT obj_description('aqo_execution_time'::regproc::oid);
2222
SELECT obj_description('aqo_drop_class'::regproc::oid);
2323
SELECT obj_description('aqo_cleanup'::regproc::oid);
24-
SELECT obj_description('aqo_reset_query'::regproc::oid);
2524
SELECT obj_description('aqo_reset'::regproc::oid);
2625

2726
\df aqo_cardinality_error
2827
\df aqo_execution_time
2928
\df aqo_drop_class
3029
\df aqo_cleanup
31-
\df aqo_reset_query
3230
\df aqo_reset
3331

3432
-- Check stat reset

sql/relocatable.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ ORDER BY (md5(query_text))
4141
*/
4242
SELECT aqo_disable_query(id) FROM (
4343
SELECT queryid AS id FROM aqo_queries WHERE queryid <> 0) AS q1;
44-
SELECT learn_aqo, use_aqo, auto_tuning FROM test.aqo_queries;
44+
SELECT learn_aqo, use_aqo, auto_tuning FROM test.aqo_queries
45+
ORDER BY (learn_aqo, use_aqo, auto_tuning);
4546
SELECT aqo_enable_query(id) FROM (
4647
SELECT queryid AS id FROM aqo_queries WHERE queryid <> 0) AS q1;
47-
SELECT learn_aqo, use_aqo, auto_tuning FROM test.aqo_queries;
48+
SELECT learn_aqo, use_aqo, auto_tuning FROM test.aqo_queries
49+
ORDER BY (learn_aqo, use_aqo, auto_tuning);
4850

4951
RESET search_path;
5052
DROP TABLE test CASCADE;

0 commit comments

Comments
 (0)