Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 480d9cb

Browse files
committed
Remove unnecessary declaration of an UI routine
1 parent 1d11dc5 commit 480d9cb

File tree

1 file changed

+0
-56
lines changed

1 file changed

+0
-56
lines changed

aqo--1.4--1.5.sql

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -20,62 +20,6 @@ CREATE TABLE public.aqo_data (
2020
);
2121
CREATE UNIQUE INDEX aqo_fss_access_idx ON public.aqo_data (fspace_hash, fsspace_hash);
2222

23-
24-
--
25-
-- Remove rows from the AQO ML knowledge base, related to previously dropped
26-
-- tables of the database.
27-
--
28-
CREATE OR REPLACE FUNCTION public.clean_aqo_data() RETURNS void AS $$
29-
DECLARE
30-
aqo_data_row aqo_data%ROWTYPE;
31-
aqo_queries_row aqo_queries%ROWTYPE;
32-
aqo_query_texts_row aqo_query_texts%ROWTYPE;
33-
aqo_query_stat_row aqo_query_stat%ROWTYPE;
34-
oid_var oid;
35-
fspace_hash_var bigint;
36-
delete_row boolean DEFAULT false;
37-
BEGIN
38-
FOR aqo_data_row IN (SELECT * FROM aqo_data)
39-
LOOP
40-
delete_row = false;
41-
SELECT aqo_data_row.fspace_hash INTO fspace_hash_var FROM aqo_data;
42-
43-
IF (aqo_data_row.oids IS NOT NULL) THEN
44-
FOREACH oid_var IN ARRAY aqo_data_row.oids
45-
LOOP
46-
IF NOT EXISTS (SELECT relname FROM pg_class WHERE oid = oid_var) THEN
47-
delete_row = true;
48-
END IF;
49-
END LOOP;
50-
END IF;
51-
52-
FOR aqo_queries_row IN (SELECT * FROM public.aqo_queries)
53-
LOOP
54-
IF (delete_row = true AND fspace_hash_var <> 0 AND
55-
fspace_hash_var = aqo_queries_row.fspace_hash AND
56-
aqo_queries_row.fspace_hash = aqo_queries_row.query_hash) THEN
57-
DELETE FROM aqo_data WHERE aqo_data = aqo_data_row;
58-
DELETE FROM aqo_queries WHERE aqo_queries = aqo_queries_row;
59-
60-
FOR aqo_query_texts_row IN (SELECT * FROM aqo_query_texts)
61-
LOOP
62-
DELETE FROM aqo_query_texts
63-
WHERE aqo_query_texts_row.query_hash = fspace_hash_var AND
64-
aqo_query_texts = aqo_query_texts_row;
65-
END LOOP;
66-
67-
FOR aqo_query_stat_row IN (SELECT * FROM aqo_query_stat)
68-
LOOP
69-
DELETE FROM aqo_query_stat
70-
WHERE aqo_query_stat_row.query_hash = fspace_hash_var AND
71-
aqo_query_stat = aqo_query_stat_row;
72-
END LOOP;
73-
END IF;
74-
END LOOP;
75-
END LOOP;
76-
END;
77-
$$ LANGUAGE plpgsql;
78-
7923
DROP FUNCTION public.top_time_queries;
8024
DROP FUNCTION public.aqo_drop;
8125
DROP FUNCTION public.clean_aqo_data;

0 commit comments

Comments
 (0)