{"id":13528849,"url":"https://github.com/pingcap/go-tpc","last_synced_at":"2025-05-15T07:06:33.286Z","repository":{"id":37706366,"uuid":"219746000","full_name":"pingcap/go-tpc","owner":"pingcap","description":"A toolbox to benchmark TPC workloads in Go ","archived":false,"fork":false,"pushed_at":"2025-04-27T03:03:49.000Z","size":493,"stargazers_count":188,"open_issues_count":21,"forks_count":101,"subscribers_count":82,"default_branch":"master","last_synced_at":"2025-04-27T04:18:47.478Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pingcap.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-05T13:00:41.000Z","updated_at":"2025-04-10T16:17:58.000Z","dependencies_parsed_at":"2024-01-02T23:19:52.515Z","dependency_job_id":"31f6e16b-b641-4831-a123-bd781ed345c4","html_url":"https://github.com/pingcap/go-tpc","commit_stats":{"total_commits":162,"total_committers":32,"mean_commits":5.0625,"dds":0.7962962962962963,"last_synced_commit":"6cd9f74be874a66920d87d957c8038b49d45e45e"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pingcap%2Fgo-tpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pingcap%2Fgo-tpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pingcap%2Fgo-tpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pingcap%2Fgo-tpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pingcap","download_url":"https://codeload.github.com/pingcap/go-tpc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254292042,"owners_count":22046426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T07:00:26.190Z","updated_at":"2025-05-15T07:06:28.254Z","avatar_url":"https://github.com/pingcap.png","language":"Go","readme":"# Go TPC\n\nA toolbox to benchmark workloads in [TPC](http://www.tpc.org/) for TiDB and almost MySQL compatible databases, and PostgreSQL compatible database, such as PostgreSQL / CockroachDB / AlloyDB / Yugabyte.\n\n## Install\n\nYou can use one of the three approaches\n\n### Install using script(recommend)\n\n```bash\ncurl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/pingcap/go-tpc/master/install.sh | sh\n```\n\nAnd then open a new terminal to try `go-tpc`\n\n### Download binary\n\nYou can download the pre-built binary [here](https://github.com/pingcap/go-tpc/releases) and then gunzip it\n\n### Build from source\n\n```bash\ngit clone https://github.com/pingcap/go-tpc.git\ncd go-tpc\nmake build\n```\n\nThen you can find the `go-tpc` binary file in the `./bin` directory.\n\n## Usage\n\nIf you have `go-tpc` in your PATH, the command below you should replace `./bin/go-tpc` with `go-tpc`\n\nBy default, go-tpc uses `root::@tcp(127.0.0.1:4000)/test` as the default dsn address, you can override it by setting below flags:\n\n```bash\n  -D, --db string           Database name (default \"test\")\n  -H, --host string         Database host (default \"127.0.0.1\")\n  -p, --password string     Database password\n  -P, --port int            Database port (default 4000)\n  -U, --user string         Database user (default \"root\")\n\n```\n\n\u003e **Note:**\n\u003e\n\u003e When exporting csv files to a directory, `go-tpc` will also create the necessary tables for further data input if\n\u003e the provided database address is accessible.\n\nFor example:\n\n```bash\n./bin/go-tpc -H 127.0.0.1 -P 3306 -D tpcc ...\n```\n\n### TPC-C\n\n#### Prepare\n\n##### TiDB \u0026 MySQL\n\n```bash\n# Create 4 warehouses with 4 threads\n./bin/go-tpc tpcc --warehouses 4 prepare -T 4\n```\n\n##### PostgreSQL \u0026 CockroachDB \u0026 AlloyDB \u0026 Yugabyte\n\n\n```\n./bin/go-tpc tpcc prepare -d postgres -U myuser -p '12345678' -D test -H 127.0.0.1 -P 5432 --conn-params sslmode=disable\n```\n\n#### Run\n\n##### TiDB \u0026 MySQL\n\n```bash\n# Run TPCC workloads, you can just run or add --wait option to including wait times\n./bin/go-tpc tpcc --warehouses 4 run -T 4\n# Run TPCC including wait times(keying \u0026 thinking time) on every transactions\n./bin/go-tpc tpcc --warehouses 4 run -T 4 --wait\n```\n\n##### PostgreSQL \u0026 CockroachDB \u0026 AlloyDB \u0026 Yugabyte\n\n```\n./bin/go-tpc tpcc run -d postgres -U myuser -p '12345678' -D test -H 127.0.0.1 -P 5432 --conn-params sslmode=disable\n```\n\n#### Check\n\n```bash\n# Check consistency. you can check after prepare or after run\n./bin/go-tpc tpcc --warehouses 4 check\n```\n\n#### Clean up\n\n```bash\n# Cleanup\n./bin/go-tpc tpcc --warehouses 4 cleanup\n```\n\n#### Other usages\n\n```bash\n# Generate csv files (split to 100 files each table)\n./bin/go-tpc tpcc --warehouses 4 prepare -T 100 --output-type csv --output-dir data\n# Specified tables when generating csv files\n./bin/go-tpc tpcc --warehouses 4 prepare -T 100 --output-type csv --output-dir data --tables history,orders\n# Start pprof\n./bin/go-tpc tpcc --warehouses 4 prepare --output-type csv --output-dir data --pprof :10111\n```\n\nIf you want to import tpcc data into TiDB, please refer to [import-to-tidb](docs/import-to-tidb.md).\n\n### TPC-H\n\n#### Prepare\n\n##### TiDB \u0026 MySQL\n\n```bash\n# Prepare data with scale factor 1\n./bin/go-tpc tpch --sf=1 prepare\n# Prepare data with scale factor 1, create tiflash replica, and analyze table after data loaded\n./bin/go-tpc tpch --sf 1 --analyze --tiflash-replica 1 prepare\n```\n\n##### PostgreSQL \u0026 CockroachDB \u0026 AlloyDB \u0026 Yugabyte\n\n```\n./bin/go-tpc tpch prepare -d postgres -U myuser -p '12345678' -D test -H 127.0.0.1 -P 5432 --conn-params sslmode=disable\n```\n\n#### Run\n##### TiDB \u0026 MySQL\n\n```bash\n# Run TPCH workloads with result checking\n./bin/go-tpc tpch --sf=1 --check=true run\n# Run TPCH workloads without result checking\n./bin/go-tpc tpch --sf=1 run\n```\n\n##### PostgreSQL \u0026 CockroachDB \u0026 AlloyDB \u0026 Yugabyte\n\n```\n./bin/go-tpc tpch run -d postgres -U myuser -p '12345678' -D test -H 127.0.0.1 -P 5432 --conn-params sslmode=disable\n```\n#### Clean up\n\n```bash\n# Cleanup\n./bin/go-tpc tpch cleanup\n```\n\n### CH-benCHmark\n\n#### Prepare\n\n1. First please refer to the above instruction(`go-tpc tpcc --warehouses $warehouses prepare`) to prepare the TP part schema and populate data\n\n2. Then uses `go-tpc ch prepare` to prepare the AP part schema and data\n\nA detail example to run CH workload on TiDB can be refered to [TiDB Doc](https://docs.pingcap.com/tidb/dev/benchmark-tidb-using-ch)\n\n##### TiDB \u0026 MySQL\n```bash\n# Prepare TP data\n./bin/go-tpc tpcc --warehouses 10 prepare -T 4 -D test -H 127.0.0.1 -P 4000\n# Prepare AP data, create tiflash replica, and analyze table after data loaded\n./bin/go-tpc ch --analyze --tiflash-replica 1 prepare -D test -H 127.0.0.1 -P 4000\n```\n##### PostgreSQL \u0026 CockroachDB \u0026 AlloyDB \u0026 Yugabyte\n\n``` bash\n# Prepare TP data\n./bin/go-tpc tpcc prepare -d postgres -U myuser -p '12345678' -D test -H 127.0.0.1 -P 5432 --conn-params sslmode=disable -T 4\n# Prepare AP data\n./bin/go-tpc ch prepare -d postgres -U myuser -p '12345678' -D test -H 127.0.0.1 -P 5432 --conn-params sslmode=disable\n```\n\n#### Run\n\n##### TiDB \u0026 MySQL\n```bash\n./bin/go-tpc ch --warehouses $warehouses -T $tpWorkers -t $apWorkers --time $measurement-time run\n```\n##### PostgreSQL \u0026 CockroachDB \u0026 AlloyDB \u0026 Yugabyte\n\n```\n./bin/go-tpc ch run -d postgres -U myuser -p '12345678' -D test -H 127.0.0.1 -P 5432 --conn-params sslmode=disable\n```\n\n### Raw SQL\n`rawsql` command is used to execute sql from given sql files.\n\n#### Run\n```bash\n./bin/go-tpc rawsql run --query-files $path-to-query-files\n```\n","funding_links":[],"categories":["Benchmarking"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpingcap%2Fgo-tpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpingcap%2Fgo-tpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpingcap%2Fgo-tpc/lists"}