{"id":15468490,"url":"https://github.com/winebarrel/pgslap","last_synced_at":"2025-04-22T11:29:00.585Z","repository":{"id":44429018,"uuid":"388014197","full_name":"winebarrel/pgslap","owner":"winebarrel","description":"pgslap is a PostgreSQL load testing tool like mysqlslap.","archived":false,"fork":false,"pushed_at":"2021-07-21T08:14:39.000Z","size":33,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-19T00:16:10.101Z","etag":null,"topics":["database","golang","load-testing","postgresql"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/winebarrel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-21T06:16:00.000Z","updated_at":"2024-03-13T15:29:54.000Z","dependencies_parsed_at":"2022-09-12T02:11:40.932Z","dependency_job_id":null,"html_url":"https://github.com/winebarrel/pgslap","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winebarrel%2Fpgslap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winebarrel%2Fpgslap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winebarrel%2Fpgslap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/winebarrel%2Fpgslap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/winebarrel","download_url":"https://codeload.github.com/winebarrel/pgslap/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250231396,"owners_count":21396454,"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":["database","golang","load-testing","postgresql"],"created_at":"2024-10-02T01:41:25.108Z","updated_at":"2025-04-22T11:29:00.569Z","avatar_url":"https://github.com/winebarrel.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pgslap\n\npgslap is a PostgreSQL load testing tool like [mysqlslap](https://dev.mysql.com/doc/refman/8.0/en/mysqlslap.html).\n\n## Usage\n\n```\npgslap - PostgreSQL load testing tool like mysqlslap.\n\n  Flags:\n       --version                               Displays the program version string.\n    -h --help                                  Displays help with available flag, subcommand, and positional value parameters.\n    -u --url                                   Database URL, e.g. 'postgres://username:password@localhost:5432'.\n    -n --nagents                               Number of agents. (default: 1)\n    -t --time                                  Test run time (sec). Zero is infinity. (default: 60)\n       --number-queries                        Number of queries to execute per agent. Zero is infinity. (default: 0)\n    -r --rate                                  Rate limit for each agent (qps). Zero is unlimited. (default: 0)\n    -a --auto-generate-sql                     Automatically generate SQL to execute.\n       --auto-generate-sql-guid-primary        Use GUID as the primary key of the table to be created.\n    -q --query                                 SQL to execute. (file or string)\n       --auto-generate-sql-write-number        Number of rows to be pre-populated for each agent. (default: 100)\n    -l --auto-generate-sql-load-type           Test load type: 'mixed', 'update', 'write', 'key', or 'read'. (default: mixed)\n       --auto-generate-sql-secondary-indexes   Number of secondary indexes in the table to be created. (default: 0)\n       --commit-rate                           Commit every X queries. (default: 0)\n       --mixed-sel-ins-ratio                   Mixed load type 'SELECT:INSERT' ratio. (default: 1:1)\n    -x --number-char-cols                      Number of VARCHAR columns in the table to be created. (default: 1)\n       --char-cols-index                       Create indexes on VARCHAR columns in the table to be created.\n    -y --number-int-cols                       Number of INT columns in the table to be created. (default: 1)\n       --int-cols-index                        Create indexes on INT columns in the table to be created.\n       --pre-query                             Queries to be pre-executed for each agent.\n       --create                                SQL for creating custom tables. (file or string)\n       --drop-db                               Forcibly delete the existing DB.\n       --no-drop                               Do not drop database after testing.\n       --hinterval                             Histogram interval, e.g. '100ms'. (default: 0)\n    -F --delimiter                             SQL statements delimiter. (default: ;)\n       --only-print                            Just print SQL without connecting to DB.\n       --no-progress                           Do not show progress.\n```\n\n```\n$ pgslap -u 'postgres://scott@localhost:5432' -n 10 -r 100 -t 10 -a -l mixed -x 3 -y 3\n00:10 | 10 agents / run 9090 queries (1010 qps)\n\n{\n  \"URL\": \"postgres://scott@localhost:5432\",\n  \"StartedAt\": \"2021-07-21T17:08:10.919264+09:00\",\n  \"FinishedAt\": \"2021-07-21T17:08:20.932804+09:00\",\n  \"ElapsedTime\": 10,\n  \"NAgents\": 10,\n  \"Rate\": 100,\n  \"AutoGenerateSql\": true,\n  \"NumberPrePopulatedData\": 100,\n  \"NumberQueriesToExecute\": 0,\n  \"DropExistingDatabase\": false,\n  \"UseExistingDatabase\": true,\n  \"NoDropDatabase\": false,\n  \"LoadType\": \"mixed\",\n  \"GuidPrimary\": false,\n  \"NumberSecondaryIndexes\": 0,\n  \"CommitRate\": 0,\n  \"MixedSelRatio\": 1,\n  \"MixedInsRatio\": 1,\n  \"NumberIntCols\": 3,\n  \"IntColsIndex\": false,\n  \"NumberCharCols\": 3,\n  \"CharColsIndex\": false,\n  \"PreQueries\": null,\n  \"GOMAXPROCS\": 16,\n  \"QueryCount\": 9595,\n  \"AvgQPS\": 958.2145909634482,\n  \"MaxQPS\": 1010,\n  \"MinQPS\": 5,\n  \"MedianQPS\": 1010,\n  \"ExpectedQPS\": 1000,\n  \"Response\": {\n    \"Time\": {\n      \"Cumulative\": \"4.808905566s\",\n      \"HMean\": \"340.992µs\",\n      \"Avg\": \"501.188µs\",\n      \"P50\": \"404.475µs\",\n      \"P75\": \"687.146µs\",\n      \"P95\": \"902.047µs\",\n      \"P99\": \"1.25769ms\",\n      \"P999\": \"6.284183ms\",\n      \"Long5p\": \"1.451295ms\",\n      \"Short5p\": \"164.521µs\",\n      \"Max\": \"6.708257ms\",\n      \"Min\": \"3.04µs\",\n      \"Range\": \"6.705217ms\",\n      \"StdDev\": \"416.557µs\"\n    },\n    \"Rate\": {\n      \"Second\": 1995.2564816075244\n    },\n    \"Samples\": 9595,\n    \"Count\": 9595,\n    \"Histogram\": [\n      {\n        \"3µs - 673µs\": 7044\n      },\n      {\n        \"673µs - 1.344ms\": 2465\n      },\n      {\n        \"1.344ms - 2.014ms\": 20\n      },\n      {\n        \"2.014ms - 2.685ms\": 16\n      },\n      {\n        \"2.685ms - 3.355ms\": 4\n      },\n      {\n        \"3.355ms - 4.026ms\": 14\n      },\n      {\n        \"4.026ms - 4.696ms\": 12\n      },\n      {\n        \"4.696ms - 5.367ms\": 2\n      },\n      {\n        \"5.367ms - 6.037ms\": 3\n      },\n      {\n        \"6.037ms - 6.708ms\": 15\n      }\n    ]\n  }\n}\n```\n\n## Use Custom Query\n\n```\npgslap -u 'postgres://scott@localhost:5432' \\\n  --create 'create table test (id int); insert into test values (1)' \\\n  -q 'select id from test; select count(id) from test'\n```\n\n## Related Links\n\n* MySQL load testing tool like mysqlslap\n    * https://github.com/winebarrel/qlap\n* DB load testing tool\n    * https://github.com/winebarrel/qube\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwinebarrel%2Fpgslap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwinebarrel%2Fpgslap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwinebarrel%2Fpgslap/lists"}