]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add the "star" testset to speedtest1. Include it as part of "mix1".
authordrh <>
Sun, 9 Feb 2025 00:54:56 +0000 (00:54 +0000)
committerdrh <>
Sun, 9 Feb 2025 00:54:56 +0000 (00:54 +0000)
FossilOrigin-Name: f1345b84eaae5404268df1d0449c409fe5c4a4f9742bd67a75c7333c8c9cd597

manifest
manifest.uuid
test/speedtest1.c

index 66664febfff1ecb2286f15555f55c0426729051e..a6ff85864cc8341ee77a0aef6a9801e064b3ca5e 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Put\sa\s16-byte\shash\stable\sfor\scolumn\snames\son\seach\sTable\sobject,\sto\sspeed\nup\scolumn\sname\slookups.
-D 2025-02-08T16:16:08.621
+C Add\sthe\s"star"\stestset\sto\sspeedtest1.\s\sInclude\sit\sas\spart\sof\s"mix1".
+D 2025-02-09T00:54:56.995
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d
@@ -1681,7 +1681,7 @@ F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa
 F test/speed4p.test 377a0c48e5a92e0b11c1c5ebb1bc9d83a7312c922bc0cb05970ef5d6a96d1f0c
 F test/speedtest.md ee958457ae1b729d9715ae33c0320600000bf1d9ddea1a88dcf79f56729d6fad
 F test/speedtest.tcl 185f80f8db275852746e8150137b31ba4aaa1c9a1ecb1e35a3b66cd3f31783b9 x
-F test/speedtest1.c 204acd8af326bbca2c28f68166635d4574381f4cabbac1bc243663f5dcc5051d
+F test/speedtest1.c ef340d391366afc875d11fc59332601c470154352b0db836b2cba813999a8fb4
 F test/spellfix.test 951a6405d49d1a23d6b78027d3877b4a33eeb8221dcab5704b499755bb4f552e
 F test/spellfix2.test dfc8f519a3fc204cb2dfa8b4f29821ae90f6f8c3
 F test/spellfix3.test 0f9efaaa502a0e0a09848028518a6fb096c8ad33
@@ -2209,8 +2209,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 351dbbc2bf0b23efdc625ddaa5dc2239cf2990addf071a04bd41612b341de8c8
-R cda99bdc5b1dd85ef2acf18a1826a5a1
+P 11eb8f99e5c4974cb6ba39e5bbc99f6b88b9e01006b70d5fea85c2a6d4f7044f
+R 1a1bec3385a102a8e6f260d5d8c260d8
 U drh
-Z c5517dc029ab4cf78c2ac97792e86679
+Z 34712e1b605bf59fda97cb6a7434984c
 # Remove this line to create a well-formed Fossil manifest.
index c62113f3d69454f214c9224240a50eff959ea125..ac22274f1b65ae306d4c09f0fc921dcceb43f85c 100644 (file)
@@ -1 +1 @@
-11eb8f99e5c4974cb6ba39e5bbc99f6b88b9e01006b70d5fea85c2a6d4f7044f
+f1345b84eaae5404268df1d0449c409fe5c4a4f9742bd67a75c7333c8c9cd597
index 9d8ddc4545eb2ba48d816e7b4308d7a9e0190630..c6d5fd4a1099cd0ab41654335dc64f0b440cc935 100644 (file)
@@ -64,10 +64,9 @@ static const char zHelp[] =
   "  --stats             Show statistics at the end\n"
   "  --stmtscanstatus    Activate SQLITE_DBCONFIG_STMT_SCANSTATUS\n"
   "  --temp N            N from 0 to 9.  0: no temp table. 9: all temp tables\n"
-  "  --testset T         Run test-set T (main, cte, rtree, orm, fp, json,"
-                                                                    " debug)\n"
-  "                      Can be a comma-separated list of values, with /SCALE\n"
-  "                      suffixes or macro \"mix1\"\n"
+  "  --testset T         Run test-set T (main, cte, rtree, orm, fp, json,\n"
+  "                      star, debug).  Can be a comma-separated list of\n"
+  "                      values, with /SCALE suffixes or macro \"mix1\"\n"
   "  --trace             Turn on SQL tracing\n"
   "  --threads N         Use up to N threads for sorting\n"
   "  --utf16be           Set text encoding to UTF-16BE\n"
@@ -1458,6 +1457,114 @@ void testset_fp(void){
   speedtest1_end_test();
 }
 
+/*
+** A testset for star-schema queries.
+*/
+void testset_star(void){
+  int n;
+  int i;
+  n = g.szTest*50;
+  speedtest1_begin_test(100, "Create a fact table with %d entries", n);
+  speedtest1_exec(
+    "CREATE TABLE facttab("
+     " attr01 INT,"
+     " attr02 INT,"
+     " attr03 INT,"
+     " data01 TEXT,"
+     " attr04 INT,"
+     " attr05 INT,"
+     " attr06 INT,"
+     " attr07 INT,"
+     " attr08 INT,"
+     " factid INTEGER PRIMARY KEY,"
+     " data02 TEXT"
+    ");"
+  );
+  speedtest1_exec(
+    "WITH RECURSIVE counter(nnn) AS"
+       "(VALUES(1) UNION ALL SELECT nnn+1 FROM counter WHERE nnn<%d)"
+    "INSERT INTO facttab(attr01,attr02,attr03,attr04,attr05,"
+                        "attr06,attr07,attr08,data01,data02)"
+    "SELECT random()%%12, random()%%13, random()%%14, random()%%15,"
+           "random()%%16, random()%%17, random()%%18, random()%%19,"
+           "concat('data-',nnn), format('%%x',random()) FROM counter;",
+    n
+  );
+  speedtest1_end_test();
+
+  speedtest1_begin_test(110, "Create indexes on all attributes columns");
+  for(i=1; i<=8; i++){
+    speedtest1_exec(
+      "CREATE INDEX fact_attr%02d ON facttab(attr%02d)", i, i
+    );
+  }
+  speedtest1_end_test();
+
+  speedtest1_begin_test(120, "Create dimension tables");
+  for(i=1; i<=8; i++){
+    speedtest1_exec(
+      "CREATE TABLE dimension%02d("
+        "beta%02d INT, "
+        "content%02d TEXT, "
+        "rate%02d REAL)",
+      i, i, i, i
+    );
+    speedtest1_exec(
+      "WITH RECURSIVE ctr(nn) AS"
+      " (VALUES(1) UNION ALL SELECT nn+1 FROM ctr WHERE nn<%d)"
+      " INSERT INTO dimension%02d"
+      "   SELECT nn%%(%d), concat('content-%02d-',nn),"
+               " (random()%%10000)*0.125 FROM ctr;",
+      4*(i+1), i, 2*(i+1), i
+    );
+    if( i&2 ){
+      speedtest1_exec(
+         "CREATE INDEX dim%02d ON dimension%02d(beta%02d);",
+         i, i, i
+      );
+    }else{
+      speedtest1_exec(
+         "CREATE INDEX dim%02d ON dimension%02d(beta%02d,content%02d);",
+         i, i, i, i
+      );
+    }
+  }
+  speedtest1_end_test();
+
+  speedtest1_begin_test(130, "Star query over the entire fact table");
+  speedtest1_exec(
+    "SELECT count(*), max(content04), min(content03), sum(rate04), avg(rate05)"
+    " FROM facttab, dimension01, dimension02, dimension03, dimension04,"
+                  " dimension05, dimension06, dimension07, dimension08"
+    " WHERE attr01=beta01"
+      " AND attr02=beta02"
+      " AND attr03=beta03"
+      " AND attr04=beta04"
+      " AND attr05=beta05"
+      " AND attr06=beta06"
+      " AND attr07=beta07"
+      " AND attr08=beta08"
+    ";"
+   );
+  speedtest1_end_test();
+
+  speedtest1_begin_test(130, "Star query with LEFT JOINs");
+  speedtest1_exec(
+    "SELECT count(*), max(content04), min(content03), sum(rate04), avg(rate05)"
+    " FROM facttab LEFT JOIN dimension01 ON attr01=beta01"
+                 " LEFT JOIN dimension02 ON attr02=beta02"
+                 " JOIN dimension03 ON attr03=beta03"
+                 " JOIN dimension04 ON attr04=beta04"
+                 " JOIN dimension05 ON attr05=beta05"
+                 " LEFT JOIN dimension06 ON attr06=beta06"
+                 " JOIN dimension07 ON attr07=beta07"
+                 " JOIN dimension08 ON attr08=beta08"
+    " WHERE facttab.data01 LIKE 'data-9%%'"
+    ";"
+   );
+  speedtest1_end_test();
+}
+
 #ifdef SQLITE_ENABLE_RTREE
 /* Generate two numbers between 1 and mx.  The first number is less than
 ** the second.  Usually the numbers are near each other but can sometimes
@@ -2560,7 +2667,8 @@ int main(int argc, char **argv){
         }
         g.eTemp = argv[i][0] - '0';
       }else if( strcmp(z,"testset")==0 ){
-        static char zMix1Tests[] = "main,orm/25,cte/20,json,fp/3,parsenumber/25,rtree/10";
+        static char zMix1Tests[] =
+            "main,orm/25,cte/20,json,fp/3,parsenumber/25,rtree/10,star";
         ARGC_VALUE_CHECK(1);
         zTSet = argv[++i];
         if( strcmp(zTSet,"mix1")==0 ) zTSet = zMix1Tests;
@@ -2749,6 +2857,8 @@ int main(int argc, char **argv){
       testset_orm();
     }else if( strcmp(zThisTest,"cte")==0 ){
       testset_cte();
+    }else if( strcmp(zThisTest,"star")==0 ){
+      testset_star();
     }else if( strcmp(zThisTest,"fp")==0 ){
       testset_fp();
     }else if( strcmp(zThisTest,"json")==0 ){