11-- complain if script is sourced in psql, rather than via CREATE EXTENSION
22\echo Use " CREATE EXTENSION aqo" to load this file. \quit
33
4- CREATE TABLE aqo_queries (
4+ CREATE TABLE public . aqo_queries (
55 query_hash bigint CONSTRAINT aqo_queries_query_hash_idx PRIMARY KEY ,
66 learn_aqo boolean NOT NULL ,
77 use_aqo boolean NOT NULL ,
88 fspace_hash bigint NOT NULL ,
99 auto_tuning boolean NOT NULL
1010);
1111
12- CREATE TABLE aqo_query_texts (
13- query_hash bigint CONSTRAINT aqo_query_texts_query_hash_idx PRIMARY KEY REFERENCES aqo_queries ON DELETE CASCADE ,
12+ CREATE TABLE public . aqo_query_texts (
13+ query_hash bigint CONSTRAINT aqo_query_texts_query_hash_idx PRIMARY KEY REFERENCES public . aqo_queries ON DELETE CASCADE ,
1414 query_text text NOT NULL
1515);
1616
17- CREATE TABLE aqo_query_stat (
18- query_hash bigint CONSTRAINT aqo_query_stat_idx PRIMARY KEY REFERENCES aqo_queries ON DELETE CASCADE ,
17+ CREATE TABLE public . aqo_query_stat (
18+ query_hash bigint CONSTRAINT aqo_query_stat_idx PRIMARY KEY REFERENCES public . aqo_queries ON DELETE CASCADE ,
1919 execution_time_with_aqo double precision [],
2020 execution_time_without_aqo double precision [],
2121 planning_time_with_aqo double precision [],
@@ -26,33 +26,33 @@ CREATE TABLE aqo_query_stat (
2626 executions_without_aqo bigint
2727);
2828
29- CREATE TABLE aqo_data (
30- fspace_hash bigint NOT NULL REFERENCES aqo_queries ON DELETE CASCADE ,
29+ CREATE TABLE public . aqo_data (
30+ fspace_hash bigint NOT NULL REFERENCES public . aqo_queries ON DELETE CASCADE ,
3131 fsspace_hash int NOT NULL ,
3232 nfeatures int NOT NULL ,
3333 features double precision [][],
3434 targets double precision []
3535);
3636
37- CREATE UNIQUE INDEX aqo_fss_access_idx ON aqo_data (fspace_hash, fsspace_hash);
37+ CREATE UNIQUE INDEX aqo_fss_access_idx ON public . aqo_data (fspace_hash, fsspace_hash);
3838
39- INSERT INTO aqo_queries VALUES (0 , false, false, 0 , false);
40- INSERT INTO aqo_query_texts VALUES (0 , ' COMMON feature space (do not delete!)' );
39+ INSERT INTO public . aqo_queries VALUES (0 , false, false, 0 , false);
40+ INSERT INTO public . aqo_query_texts VALUES (0 , ' COMMON feature space (do not delete!)' );
4141-- a virtual query for COMMON feature space
4242
4343CREATE FUNCTION invalidate_deactivated_queries_cache () RETURNS trigger
4444 AS ' MODULE_PATHNAME' LANGUAGE C;
4545
4646CREATE TRIGGER aqo_queries_invalidate AFTER UPDATE OR DELETE OR TRUNCATE
47- ON aqo_queries FOR EACH STATEMENT
47+ ON public . aqo_queries FOR EACH STATEMENT
4848 EXECUTE PROCEDURE invalidate_deactivated_queries_cache();
4949
5050--
5151-- Service functions
5252--
5353
5454-- Show query state at the AQO knowledge base
55- CREATE FUNCTION aqo_status (hash bigint )
55+ CREATE FUNCTION public . aqo_status(hash bigint )
5656RETURNS TABLE (
5757 " learn" BOOL,
5858 " use aqo" BOOL,
@@ -73,58 +73,58 @@ SELECT learn_aqo,use_aqo,auto_tuning,fspace_hash,
7373 to_char(execution_time_with_aqo[n3],' 9.99EEEE' ),
7474 to_char(cardinality_error_with_aqo[n1],' 9.99EEEE' ),
7575 executions_with_aqo
76- FROM aqo_queries aq, aqo_query_stat aqs,
76+ FROM public . aqo_queries aq, public . aqo_query_stat aqs,
7777 (SELECT array_length(n1,1 ) AS n1, array_length(n2,1 ) AS n2,
7878 array_length(n3,1 ) AS n3, array_length(n4,1 ) AS n4
7979 FROM
8080 (SELECT cardinality_error_with_aqo AS n1,
8181 cardinality_error_without_aqo AS n2,
8282 execution_time_with_aqo AS n3,
8383 execution_time_without_aqo AS n4
84- FROM aqo_query_stat aqs WHERE
84+ FROM public . aqo_query_stat aqs WHERE
8585 aqs .query_hash = $1 ) AS al) AS q
8686WHERE (aqs .query_hash = aq .query_hash ) AND
8787 aqs .query_hash = $1 ;
8888$func$ LANGUAGE SQL;
8989
90- CREATE FUNCTION aqo_enable_query (hash bigint )
90+ CREATE FUNCTION public . aqo_enable_query(hash bigint )
9191RETURNS VOID
9292AS $func$
93- UPDATE aqo_queries SET
93+ UPDATE public . aqo_queries SET
9494 learn_aqo = ' true' ,
9595 use_aqo = ' true'
9696 WHERE query_hash = $1 ;
9797$func$ LANGUAGE SQL;
9898
99- CREATE FUNCTION aqo_disable_query (hash bigint )
99+ CREATE FUNCTION public . aqo_disable_query(hash bigint )
100100RETURNS VOID
101101AS $func$
102- UPDATE aqo_queries SET
102+ UPDATE public . aqo_queries SET
103103 learn_aqo = ' false' ,
104104 use_aqo = ' false' ,
105105 auto_tuning = ' false'
106106 WHERE query_hash = $1 ;
107107$func$ LANGUAGE SQL;
108108
109- CREATE FUNCTION aqo_clear_hist (hash bigint )
109+ CREATE FUNCTION public . aqo_clear_hist(hash bigint )
110110RETURNS VOID
111111AS $func$
112- DELETE FROM aqo_data WHERE fspace_hash= $1 ;
112+ DELETE FROM public . aqo_data WHERE fspace_hash= $1 ;
113113$func$ LANGUAGE SQL;
114114
115115-- Show queries that contains 'Never executed' nodes at the plan.
116- CREATE FUNCTION aqo_ne_queries ()
116+ CREATE FUNCTION public . aqo_ne_queries()
117117RETURNS SETOF int
118118AS $func$
119- SELECT query_hash FROM aqo_query_stat aqs
119+ SELECT query_hash FROM public . aqo_query_stat aqs
120120 WHERE - 1 = ANY (cardinality_error_with_aqo::double precision []);
121121$func$ LANGUAGE SQL;
122122
123- CREATE FUNCTION aqo_drop (hash bigint )
123+ CREATE FUNCTION public . aqo_drop(hash bigint )
124124RETURNS VOID
125125AS $func$
126- DELETE FROM aqo_queries aq WHERE (aq .query_hash = $1 );
127- DELETE FROM aqo_data ad WHERE (ad .fspace_hash = $1 );
128- DELETE FROM aqo_query_stat aq WHERE (aq .query_hash = $1 );
129- DELETE FROM aqo_query_texts aq WHERE (aq .query_hash = $1 );
126+ DELETE FROM public . aqo_queries aq WHERE (aq .query_hash = $1 );
127+ DELETE FROM public . aqo_data ad WHERE (ad .fspace_hash = $1 );
128+ DELETE FROM public . aqo_query_stat aq WHERE (aq .query_hash = $1 );
129+ DELETE FROM public . aqo_query_texts aq WHERE (aq .query_hash = $1 );
130130$func$ LANGUAGE SQL;
0 commit comments