gitlab.com/CoiaPrant/sqlite3@v1.19.1/tpch/main.go (about) 1 // Copyright 2021 The Sqlite Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // TPC BENCHMARK TM H 6 // (Decision Support) 7 // Standard Specification 8 // Revision 2.17.1 9 // 10 // Transaction Processing Performance Council (TPC) 11 // Presidio of San Francisco 12 // Building 572B Ruger St. (surface) 13 // P.O. Box 29920 (mail) 14 // San Francisco, CA 94129-0920 15 // Voice:415-561-6272 16 // Fax:415-561-6120 17 // Email: webmaster@tpc.org 18 // © 1993 - 2014 Transaction Processing Performance Council 19 20 package main 21 22 import ( 23 "flag" 24 "fmt" 25 "log" 26 "strings" 27 28 "gitlab.com/CoiaPrant/sqlite3/tpch/driver" 29 _ "gitlab.com/CoiaPrant/sqlite3/tpch/driver/drivers" 30 ) 31 32 // 4.1.3.1 Scale factors used for the test database must be chosen from the set 33 // of fixed scale factors defined as follows: 34 // 35 // 1, 10, 30, 100, 300, 1000, 3000, 10000, 30000, 100000 36 // 37 // The database size is defined with reference to scale factor 1 (i.e., SF = 1; 38 // approximately 1GB as per Clause 4.2.5), the minimum required size for a test 39 // database. Therefore, the following series of database sizes corresponds to 40 // the series of scale factors and must be used in the metric names QphH@Size 41 // and Price-per-QphH@Size (see Clause 5.4), as well as in the executive 42 // summary statement (see Appendix E): 43 // 44 // 1GB, 10GB, 30GB, 100GB, 300GB, 1000GB, 3000GB, 10000GB, 30000GB, 100000GB 45 // 46 // Where GB stands for gigabyte, defined to be 2^30 bytes. 47 // 48 // Comment 1: Although the minimum size of the test database for a valid 49 // performance test is 1GB (i.e., SF = 1), a test database of 3GB (i.e., SF = 50 // 3) is not permitted. This requirement is intended to encourage comparability 51 // of results at the low end and to ensure a substantial actual difference in 52 // test database sizes. 53 // 54 // Comment 2: The maximum size of the test database for a valid performance 55 // test is currently set at 100000 (i.e., SF = 100,000). The TPC recognizes 56 // that additional benchmark development work is necessary to allow TPC-H to 57 // scale beyond that limit. 58 59 func main() { 60 log.SetFlags(0) 61 62 dbgen := flag.Bool("dbgen", false, "Generate test DB. (Several GB)") 63 list := flag.Bool("list", false, "List registered drivers") 64 maxrecs := flag.Int("recs", -1, "Limit table recs. Use specs if < 0.") 65 mem := flag.Bool("mem", false, "Run test with DB in mem, if SUT supports that.") 66 pseudotext := flag.Bool("pseudotext", false, "generate testdata/pseudotext (300MB).") 67 q := flag.Int("q", 0, "Query to run, if > 0. Valid values in [1, 2].") 68 sf := flag.Int("sf", 1, "Scale factor.") 69 sutName := flag.String("sut", "", "System Under Test name.") 70 verbose := flag.Bool("v", false, "Verbose.") 71 72 flag.Parse() 73 maxRecs = *maxrecs 74 switch *sf { 75 case 1, 10, 30, 100, 300, 1000, 3000, 10000, 30000, 100000: 76 // nop 77 default: 78 log.Fatalf("Invalid -sf value: %v", *sf) 79 } 80 81 var sut driver.SUT 82 nm := strings.TrimSpace(*sutName) 83 if nm == "" && !*pseudotext && !*list { 84 log.Fatal("Missing SUT name") 85 } 86 87 if nm != "" { 88 if sut = driver.Open(nm); sut == nil { 89 log.Fatalf("SUT not registered: %s", nm) 90 } 91 } 92 93 var err error 94 switch { 95 case *list: 96 fmt.Println(driver.List()) 97 case *pseudotext: 98 err = genPseudotext() 99 case *dbgen: 100 err = dbGen(sut, *sf) 101 case *q > 0: 102 err = run(sut, *mem, *q, *sf, *verbose) 103 } 104 105 if err != nil { 106 log.Fatal(err) 107 } 108 }