Changeset: 9a55e199e7f8 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9a55e199e7f8
Modified Files:
        clients/Tests/MAL-signatures.stable.out
        clients/Tests/MAL-signatures.stable.out.int128
        clients/Tests/SQL-dump.stable.out
        clients/Tests/SQL-dump.stable.out.int128
        sql/backends/monet5/sql.mal
        sql/backends/monet5/sql_statistics.c
        sql/backends/monet5/sql_upgrades.c
        sql/scripts/80_statistics.sql
        sql/server/rel_psm.c
        sql/server/sql_parser.y
        sql/server/sql_scan.c
        sql/test/Tests/systemfunctions.stable.out
        sql/test/Tests/systemfunctions.stable.out.int128
        sql/test/Tests/trace.sql
        sql/test/leaks/Tests/check0.stable.out.int128
        sql/test/leaks/Tests/check1.stable.out.int128
        sql/test/leaks/Tests/check2.stable.out.int128
        sql/test/leaks/Tests/check3.stable.out.int128
        sql/test/leaks/Tests/check4.stable.out.int128
        sql/test/leaks/Tests/check5.stable.out.int128
        sql/test/pg_regress/Tests/alter_table.sql
        sql/test/pg_regress/Tests/without_oid.sql
Branch: default
Log Message:

added extra flag (minmax) to limit the analyze cost (ie don't compute the 
distinct values)
Merged code of analyze cases (ie optional minmax, optional sample size)
Approved output and added upgrade code


diffs (truncated from 1530 to 300 lines):

diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -40409,25 +40409,15 @@ command sql.alpha(dec:dbl,theta:dbl):dbl
 address SQLcst_alpha_cst;
 comment Implementation of astronomy alpha function: expands the radius theta 
depending on the declination
 
-pattern sql.analyze(sch:str,tbl:str,col:str,sample:lng):void 
+pattern sql.analyze(minmax:int,sample:lng,sch:str,tbl:str,col:str):void 
 address sql_analyze;
 comment Update the database statistics table
 
-pattern sql.analyze(sch:str,tbl:str,sample:lng):void 
+pattern sql.analyze(minmax:int,sample:lng,sch:str,tbl:str):void 
 address sql_analyze;
-pattern sql.analyze(sch:str,sample:lng):void 
+pattern sql.analyze(minmax:int,sample:lng,sch:str):void 
 address sql_analyze;
-pattern sql.analyze(sample:lng):void 
-address sql_analyze;
-pattern sql.analyze(sch:str,tbl:str,col:str):void 
-address sql_analyze;
-comment Update the database statistics table
-
-pattern sql.analyze(sch:str,tbl:str):void 
-address sql_analyze;
-pattern sql.analyze(sch:str):void 
-address sql_analyze;
-pattern sql.analyze():void 
+pattern sql.analyze(minmax:int,sample:lng):void 
 address sql_analyze;
 pattern sql.argRecord(a:any...):str 
 address SQLargRecord;
diff --git a/clients/Tests/MAL-signatures.stable.out.int128 
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -51344,25 +51344,15 @@ command sql.alpha(dec:dbl,theta:dbl):dbl
 address SQLcst_alpha_cst;
 comment Implementation of astronomy alpha function: expands the radius theta 
depending on the declination
 
-pattern sql.analyze(sch:str,tbl:str,col:str,sample:lng):void 
+pattern sql.analyze(minmax:int,sample:lng,sch:str,tbl:str,col:str):void 
 address sql_analyze;
 comment Update the database statistics table
 
-pattern sql.analyze(sch:str,tbl:str,sample:lng):void 
+pattern sql.analyze(minmax:int,sample:lng,sch:str,tbl:str):void 
 address sql_analyze;
-pattern sql.analyze(sch:str,sample:lng):void 
+pattern sql.analyze(minmax:int,sample:lng,sch:str):void 
 address sql_analyze;
-pattern sql.analyze(sample:lng):void 
-address sql_analyze;
-pattern sql.analyze(sch:str,tbl:str,col:str):void 
-address sql_analyze;
-comment Update the database statistics table
-
-pattern sql.analyze(sch:str,tbl:str):void 
-address sql_analyze;
-pattern sql.analyze(sch:str):void 
-address sql_analyze;
-pattern sql.analyze():void 
+pattern sql.analyze(minmax:int,sample:lng):void 
 address sql_analyze;
 pattern sql.argRecord(a:any...):str 
 address SQLargRecord;
diff --git a/clients/Tests/SQL-dump.stable.out 
b/clients/Tests/SQL-dump.stable.out
--- a/clients/Tests/SQL-dump.stable.out
+++ b/clients/Tests/SQL-dump.stable.out
@@ -466,22 +466,13 @@ create function "abbrev" (p inet) return
        external name inet."abbrev";
 create function alpha(pdec double, pradius double)
 returns double external name sql.alpha;
-create procedure analyze()
+create procedure analyze(minmax int, "sample" bigint)
 external name sql.analyze;
-create procedure analyze(tbl string)
+create procedure analyze(minmax int, "sample" bigint, sch string)
 external name sql.analyze;
-create procedure analyze(sch string, tbl string)
+create procedure analyze(minmax int, "sample" bigint, sch string, tbl string)
 external name sql.analyze;
-create procedure analyze(sch string, tbl string, col string)
-external name sql.analyze;
--- control the sample size
-create procedure analyze("sample" bigint)
-external name sql.analyze;
-create procedure analyze(tbl string, "sample" bigint)
-external name sql.analyze;
-create procedure analyze(sch string, tbl string, "sample" bigint)
-external name sql.analyze;
-create procedure analyze(sch string, tbl string, col string, "sample" bigint)
+create procedure analyze(minmax int, "sample" bigint, sch string, tbl string, 
col string)
 external name sql.analyze;
 -- ogc Spatial Analysis methods
 
diff --git a/clients/Tests/SQL-dump.stable.out.int128 
b/clients/Tests/SQL-dump.stable.out.int128
--- a/clients/Tests/SQL-dump.stable.out.int128
+++ b/clients/Tests/SQL-dump.stable.out.int128
@@ -462,22 +462,13 @@ create function "abbrev" (p inet) return
        external name inet."abbrev";
 create function alpha(pdec double, pradius double)
 returns double external name sql.alpha;
-create procedure analyze()
+create procedure analyze(minmax int, "sample" bigint)
 external name sql.analyze;
-create procedure analyze(tbl string)
+create procedure analyze(minmax int, "sample" bigint, sch string)
 external name sql.analyze;
-create procedure analyze(sch string, tbl string)
+create procedure analyze(minmax int, "sample" bigint, sch string, tbl string)
 external name sql.analyze;
-create procedure analyze(sch string, tbl string, col string)
-external name sql.analyze;
--- control the sample size
-create procedure analyze("sample" bigint)
-external name sql.analyze;
-create procedure analyze(tbl string, "sample" bigint)
-external name sql.analyze;
-create procedure analyze(sch string, tbl string, "sample" bigint)
-external name sql.analyze;
-create procedure analyze(sch string, tbl string, col string, "sample" bigint)
+create procedure analyze(minmax int, "sample" bigint, sch string, tbl string, 
col string)
 external name sql.analyze;
 -- ogc Spatial Analysis methods
 
@@ -1699,50 +1690,50 @@ 7097    "nils"  "bigint"        64      0       7101    
NULL    true
 7098   "minval"        "clob"  0       0       7101    NULL    true    8       
NULL
 7099   "maxval"        "clob"  0       0       7101    NULL    true    9       
NULL
 7100   "sorted"        "boolean"       1       0       7101    NULL    true    
10      NULL
-7201   "file_id"       "bigint"        64      0       7209    NULL    false   
0       NULL
-7202   "file_location" "clob"  0       0       7209    NULL    false   1       
NULL
-7203   "dbschema"      "smallint"      16      0       7209    NULL    false   
2       NULL
-7204   "format_version"        "varchar"       7       0       7209    NULL    
true    3       NULL
-7205   "sorting_order" "varchar"       10      0       7209    NULL    true    
4       NULL
-7206   "comments"      "clob"  0       0       7209    NULL    true    5       
NULL
-7211   "sn"    "clob"  0       0       7222    NULL    false   0       NULL
-7212   "file_id"       "bigint"        64      0       7222    NULL    false   
1       NULL
-7213   "ln"    "int"   32      0       7222    NULL    true    2       NULL
-7214   "as"    "int"   32      0       7222    NULL    true    3       NULL
-7215   "m5"    "clob"  0       0       7222    NULL    true    4       NULL
-7216   "sp"    "clob"  0       0       7222    NULL    true    5       NULL
-7217   "ur"    "clob"  0       0       7222    NULL    true    6       NULL
-7224   "id"    "clob"  0       0       7241    NULL    false   0       NULL
-7225   "file_id"       "bigint"        64      0       7241    NULL    false   
1       NULL
-7226   "cn"    "clob"  0       0       7241    NULL    true    2       NULL
-7227   "ds"    "clob"  0       0       7241    NULL    true    3       NULL
-7228   "dt"    "timestamp"     7       0       7241    NULL    true    4       
NULL
-7229   "fo"    "clob"  0       0       7241    NULL    true    5       NULL
-7230   "ks"    "clob"  0       0       7241    NULL    true    6       NULL
-7231   "lb"    "clob"  0       0       7241    NULL    true    7       NULL
-7232   "pg"    "clob"  0       0       7241    NULL    true    8       NULL
-7233   "pi"    "int"   32      0       7241    NULL    true    9       NULL
-7234   "pl"    "clob"  0       0       7241    NULL    true    10      NULL
-7235   "pu"    "clob"  0       0       7241    NULL    true    11      NULL
-7236   "sm"    "clob"  0       0       7241    NULL    true    12      NULL
-7243   "id"    "clob"  0       0       7253    NULL    false   0       NULL
-7244   "file_id"       "bigint"        64      0       7253    NULL    false   
1       NULL
-7245   "pn"    "clob"  0       0       7253    NULL    true    2       NULL
-7246   "cl"    "clob"  0       0       7253    NULL    true    3       NULL
-7247   "pp"    "clob"  0       0       7253    NULL    true    4       NULL
-7248   "vn"    "clob"  0       0       7253    NULL    true    5       NULL
-7255   "qname" "clob"  0       0       7266    NULL    false   0       NULL
-7256   "flag"  "smallint"      16      0       7266    NULL    false   1       
NULL
-7257   "rname" "clob"  0       0       7266    NULL    false   2       NULL
-7258   "pos"   "int"   32      0       7266    NULL    false   3       NULL
-7259   "mapq"  "smallint"      16      0       7266    NULL    false   4       
NULL
-7260   "cigar" "clob"  0       0       7266    NULL    false   5       NULL
-7261   "rnext" "clob"  0       0       7266    NULL    false   6       NULL
-7262   "pnext" "int"   32      0       7266    NULL    false   7       NULL
-7263   "tlen"  "int"   32      0       7266    NULL    false   8       NULL
-7264   "seq"   "clob"  0       0       7266    NULL    false   9       NULL
-7265   "qual"  "clob"  0       0       7266    NULL    false   10      NULL
-7347   "function_id"   "int"   32      0       7348    NULL    true    0       
NULL
+7191   "file_id"       "bigint"        64      0       7199    NULL    false   
0       NULL
+7192   "file_location" "clob"  0       0       7199    NULL    false   1       
NULL
+7193   "dbschema"      "smallint"      16      0       7199    NULL    false   
2       NULL
+7194   "format_version"        "varchar"       7       0       7199    NULL    
true    3       NULL
+7195   "sorting_order" "varchar"       10      0       7199    NULL    true    
4       NULL
+7196   "comments"      "clob"  0       0       7199    NULL    true    5       
NULL
+7201   "sn"    "clob"  0       0       7212    NULL    false   0       NULL
+7202   "file_id"       "bigint"        64      0       7212    NULL    false   
1       NULL
+7203   "ln"    "int"   32      0       7212    NULL    true    2       NULL
+7204   "as"    "int"   32      0       7212    NULL    true    3       NULL
+7205   "m5"    "clob"  0       0       7212    NULL    true    4       NULL
+7206   "sp"    "clob"  0       0       7212    NULL    true    5       NULL
+7207   "ur"    "clob"  0       0       7212    NULL    true    6       NULL
+7214   "id"    "clob"  0       0       7231    NULL    false   0       NULL
+7215   "file_id"       "bigint"        64      0       7231    NULL    false   
1       NULL
+7216   "cn"    "clob"  0       0       7231    NULL    true    2       NULL
+7217   "ds"    "clob"  0       0       7231    NULL    true    3       NULL
+7218   "dt"    "timestamp"     7       0       7231    NULL    true    4       
NULL
+7219   "fo"    "clob"  0       0       7231    NULL    true    5       NULL
+7220   "ks"    "clob"  0       0       7231    NULL    true    6       NULL
+7221   "lb"    "clob"  0       0       7231    NULL    true    7       NULL
+7222   "pg"    "clob"  0       0       7231    NULL    true    8       NULL
+7223   "pi"    "int"   32      0       7231    NULL    true    9       NULL
+7224   "pl"    "clob"  0       0       7231    NULL    true    10      NULL
+7225   "pu"    "clob"  0       0       7231    NULL    true    11      NULL
+7226   "sm"    "clob"  0       0       7231    NULL    true    12      NULL
+7233   "id"    "clob"  0       0       7243    NULL    false   0       NULL
+7234   "file_id"       "bigint"        64      0       7243    NULL    false   
1       NULL
+7235   "pn"    "clob"  0       0       7243    NULL    true    2       NULL
+7236   "cl"    "clob"  0       0       7243    NULL    true    3       NULL
+7237   "pp"    "clob"  0       0       7243    NULL    true    4       NULL
+7238   "vn"    "clob"  0       0       7243    NULL    true    5       NULL
+7245   "qname" "clob"  0       0       7256    NULL    false   0       NULL
+7246   "flag"  "smallint"      16      0       7256    NULL    false   1       
NULL
+7247   "rname" "clob"  0       0       7256    NULL    false   2       NULL
+7248   "pos"   "int"   32      0       7256    NULL    false   3       NULL
+7249   "mapq"  "smallint"      16      0       7256    NULL    false   4       
NULL
+7250   "cigar" "clob"  0       0       7256    NULL    false   5       NULL
+7251   "rnext" "clob"  0       0       7256    NULL    false   6       NULL
+7252   "pnext" "int"   32      0       7256    NULL    false   7       NULL
+7253   "tlen"  "int"   32      0       7256    NULL    false   8       NULL
+7254   "seq"   "clob"  0       0       7256    NULL    false   9       NULL
+7255   "qual"  "clob"  0       0       7256    NULL    false   10      NULL
+7337   "function_id"   "int"   32      0       7338    NULL    true    0       
NULL
 COMMIT;
 START TRANSACTION;
 CREATE TABLE "sys"."_tables" (
@@ -1803,12 +1794,12 @@ 7030    "storagemodelinput"     2000    NULL    0       
tru
 7078   "storagemodel"  2000    "create view sys.storagemodel as select * from 
sys.storagemodel();"     1       true    0       0
 7088   "tablestoragemodel"     2000    "-- A summary of the table storage 
requirement is is available as a table view.\n-- The auxiliary column denotes 
the maximum space if all non-sorted columns\n-- would be augmented with a hash 
(rare situation)\ncreate view sys.tablestoragemodel\nas select 
""schema"",""table"",max(count) as ""count"",\n\tsum(columnsize) as 
columnsize,\n\tsum(heapsize) as heapsize,\n\tsum(hashes) as 
hashes,\n\tsum(imprints) as imprints,\n\tsum(case when sorted = false then 8 * 
count else 0 end) as auxiliary\nfrom sys.storagemodel() group by 
""schema"",""table"";"   1       true    0       0
 7101   "statistics"    2000    NULL    0       true    0       0
-7209   "files" 7158    NULL    0       true    0       0
-7222   "sq"    7158    NULL    0       true    0       0
-7241   "rg"    7158    NULL    0       true    0       0
-7253   "pg"    7158    NULL    0       true    0       0
-7266   "export"        7158    NULL    0       true    0       0
-7348   "systemfunctions"       2000    NULL    0       true    0       0
+7199   "files" 7148    NULL    0       true    0       0
+7212   "sq"    7148    NULL    0       true    0       0
+7231   "rg"    7148    NULL    0       true    0       0
+7243   "pg"    7148    NULL    0       true    0       0
+7256   "export"        7148    NULL    0       true    0       0
+7338   "systemfunctions"       2000    NULL    0       true    0       0
 COMMIT;
 START TRANSACTION;
 CREATE TABLE "sys"."args" (
@@ -1821,7 +1812,7 @@ CREATE TABLE "sys"."args" (
        "inout"       TINYINT,
        "number"      INTEGER
 );
-COPY 4268 RECORDS INTO "sys"."args" FROM stdin USING DELIMITERS '\t','\n','"';
+COPY 4266 RECORDS INTO "sys"."args" FROM stdin USING DELIMITERS '\t','\n','"';
 2155   30      "res_0" "oid"   63      0       0       0
 2156   30      "arg_1" "wrd"   64      0       1       1
 2157   31      "res_0" "oid"   63      0       0       0
@@ -5988,108 +5979,106 @@ 7063  7056    "heapsize"      "bigint"        64      
0       0       6
 7064   7056    "hashes"        "bigint"        64      0       0       7
 7065   7056    "imprints"      "bigint"        64      0       0       8
 7066   7056    "sorted"        "boolean"       1       0       0       9
-7106   7105    "tbl"   "clob"  0       0       1       0
-7109   7108    "sch"   "clob"  0       0       1       0
-7110   7108    "tbl"   "clob"  0       0       1       1
-7113   7112    "sch"   "clob"  0       0       1       0
-7114   7112    "tbl"   "clob"  0       0       1       1
-7115   7112    "col"   "clob"  0       0       1       2
-7118   7117    "sample"        "bigint"        64      0       1       0
-7121   7120    "tbl"   "clob"  0       0       1       0
-7122   7120    "sample"        "bigint"        64      0       1       1
-7125   7124    "sch"   "clob"  0       0       1       0
-7126   7124    "tbl"   "clob"  0       0       1       1
-7127   7124    "sample"        "bigint"        64      0       1       2
-7130   7129    "sch"   "clob"  0       0       1       0
-7131   7129    "tbl"   "clob"  0       0       1       1
-7132   7129    "col"   "clob"  0       0       1       2
-7133   7129    "sample"        "bigint"        64      0       1       3
-7136   7135    "result"        "clob"  0       0       0       0
-7137   7135    "src"   "clob"  0       0       1       1
-7140   7139    "result"        "smallint"      16      0       0       0
-7141   7139    "one"   "tinyint"       8       0       1       1
-7142   7139    "two"   "tinyint"       8       0       1       2
-7145   7144    "result"        "int"   32      0       0       0
-7146   7144    "one"   "smallint"      16      0       1       1
-7147   7144    "two"   "smallint"      16      0       1       2
-7150   7149    "result"        "bigint"        64      0       0       0
-7151   7149    "one"   "int"   32      0       1       1
-7152   7149    "two"   "int"   32      0       1       2
-7155   7154    "result"        "hugeint"       128     0       0       0
-7156   7154    "one"   "bigint"        64      0       1       1
-7157   7154    "two"   "bigint"        64      0       1       2
-7161   7160    "bam_repos"     "clob"  0       0       1       0
+7104   7103    "MinMax"        "int"   32      0       1       0
+7105   7103    "sample"        "bigint"        64      0       1       1
+7108   7107    "MinMax"        "int"   32      0       1       0
+7109   7107    "sample"        "bigint"        64      0       1       1
+7110   7107    "sch"   "clob"  0       0       1       2
+7113   7112    "MinMax"        "int"   32      0       1       0
+7114   7112    "sample"        "bigint"        64      0       1       1
+7115   7112    "sch"   "clob"  0       0       1       2
+7116   7112    "tbl"   "clob"  0       0       1       3
+7119   7118    "MinMax"        "int"   32      0       1       0
+7120   7118    "sample"        "bigint"        64      0       1       1
+7121   7118    "sch"   "clob"  0       0       1       2
+7122   7118    "tbl"   "clob"  0       0       1       3
+7123   7118    "col"   "clob"  0       0       1       4
+7126   7125    "result"        "clob"  0       0       0       0
+7127   7125    "src"   "clob"  0       0       1       1
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to