Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit edfa892

Browse files
funbringerdanolivo
authored andcommitted
inplace fix for release 1.0
1 parent 5567135 commit edfa892

File tree

1 file changed

+33
-40
lines changed

1 file changed

+33
-40
lines changed

aqo--1.0.sql

Lines changed: 33 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,58 +2,51 @@
22
\echo Use "CREATE EXTENSION aqo" to load this file. \quit
33

44
CREATE TABLE aqo_queries (
5-
query_hash int PRIMARY KEY,
6-
learn_aqo boolean NOT NULL,
7-
use_aqo boolean NOT NULL,
8-
fspace_hash int NOT NULL,
9-
auto_tuning boolean NOT NULL
5+
query_hash int4 CONSTRAINT "aqo_queries_query_hash_idx"
6+
PRIMARY KEY,
7+
learn_aqo bool NOT NULL,
8+
use_aqo bool NOT NULL,
9+
fspace_hash int4 NOT NULL,
10+
auto_tuning bool NOT NULL
1011
);
1112

1213
CREATE TABLE aqo_query_texts (
13-
query_hash int PRIMARY KEY REFERENCES aqo_queries ON DELETE CASCADE,
14-
query_text varchar NOT NULL
14+
query_hash int4 CONSTRAINT "aqo_query_texts_query_hash_idx"
15+
PRIMARY KEY REFERENCES aqo_queries ON DELETE CASCADE,
16+
query_text text NOT NULL
1517
);
1618

1719
CREATE TABLE aqo_query_stat (
18-
query_hash int PRIMARY KEY REFERENCES aqo_queries ON DELETE CASCADE,
19-
execution_time_with_aqo double precision[],
20-
execution_time_without_aqo double precision[],
21-
planning_time_with_aqo double precision[],
22-
planning_time_without_aqo double precision[],
23-
cardinality_error_with_aqo double precision[],
24-
cardinality_error_without_aqo double precision[],
25-
executions_with_aqo bigint,
26-
executions_without_aqo bigint
20+
query_hash int4 CONSTRAINT "aqo_query_stat_idx"
21+
PRIMARY KEY REFERENCES aqo_queries ON DELETE CASCADE,
22+
execution_time_with_aqo float8[],
23+
execution_time_without_aqo float8[],
24+
planning_time_with_aqo float8[],
25+
planning_time_without_aqo float8[],
26+
cardinality_error_with_aqo float8[],
27+
cardinality_error_without_aqo float8[],
28+
executions_with_aqo int8,
29+
executions_without_aqo int8
2730
);
2831

2932
CREATE TABLE aqo_data (
30-
fspace_hash int NOT NULL REFERENCES aqo_queries ON DELETE CASCADE,
31-
fsspace_hash int NOT NULL,
32-
nfeatures int NOT NULL,
33-
features double precision[][],
34-
targets double precision[],
35-
UNIQUE (fspace_hash, fsspace_hash)
33+
fspace_hash int4 NOT NULL REFERENCES aqo_queries ON DELETE CASCADE,
34+
fsspace_hash int4 NOT NULL,
35+
nfeatures int4 NOT NULL,
36+
features float8[][],
37+
targets float8[]
3638
);
3739

38-
CREATE INDEX aqo_queries_query_hash_idx ON aqo_queries (query_hash);
39-
CREATE INDEX aqo_query_texts_query_hash_idx ON aqo_query_texts (query_hash);
40-
CREATE INDEX aqo_query_stat_idx ON aqo_query_stat (query_hash);
41-
CREATE INDEX aqo_fss_access_idx ON aqo_data (fspace_hash, fsspace_hash);
40+
CREATE UNIQUE INDEX aqo_fss_access_idx ON aqo_data (fspace_hash, fsspace_hash);
4241

43-
ALTER TABLE aqo_data ALTER COLUMN features SET STORAGE MAIN;
44-
ALTER TABLE aqo_data ALTER COLUMN targets SET STORAGE MAIN;
45-
ALTER TABLE aqo_query_stat
46-
ALTER COLUMN execution_time_with_aqo SET STORAGE MAIN;
47-
ALTER TABLE aqo_query_stat
48-
ALTER COLUMN execution_time_without_aqo SET STORAGE MAIN;
49-
ALTER TABLE aqo_query_stat
50-
ALTER COLUMN planning_time_with_aqo SET STORAGE MAIN;
51-
ALTER TABLE aqo_query_stat
52-
ALTER COLUMN planning_time_without_aqo SET STORAGE MAIN;
53-
ALTER TABLE aqo_query_stat
54-
ALTER COLUMN cardinality_error_without_aqo SET STORAGE MAIN;
55-
ALTER TABLE aqo_query_stat
56-
ALTER COLUMN cardinality_error_with_aqo SET STORAGE MAIN;
42+
ALTER TABLE aqo_data ALTER COLUMN features SET STORAGE MAIN;
43+
ALTER TABLE aqo_data ALTER COLUMN targets SET STORAGE MAIN;
44+
ALTER TABLE aqo_query_stat ALTER COLUMN execution_time_with_aqo SET STORAGE MAIN;
45+
ALTER TABLE aqo_query_stat ALTER COLUMN execution_time_without_aqo SET STORAGE MAIN;
46+
ALTER TABLE aqo_query_stat ALTER COLUMN planning_time_with_aqo SET STORAGE MAIN;
47+
ALTER TABLE aqo_query_stat ALTER COLUMN planning_time_without_aqo SET STORAGE MAIN;
48+
ALTER TABLE aqo_query_stat ALTER COLUMN cardinality_error_without_aqo SET STORAGE MAIN;
49+
ALTER TABLE aqo_query_stat ALTER COLUMN cardinality_error_with_aqo SET STORAGE MAIN;
5750

5851
INSERT INTO aqo_queries VALUES (0, false, false, 0, false);
5952
INSERT INTO aqo_query_texts VALUES (0, 'COMMON feature space (do not delete!)');

0 commit comments

Comments
 (0)