{"id":29124309,"url":"https://github.com/vczyh/dbinsert","last_synced_at":"2026-04-19T10:31:10.237Z","repository":{"id":64299880,"uuid":"570025157","full_name":"vczyh/dbinsert","owner":"vczyh","description":"Database Fast Batch Insertion.","archived":false,"fork":false,"pushed_at":"2023-03-21T08:46:34.000Z","size":76,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-04T07:05:00.667Z","etag":null,"topics":["batch","bulk","db","insert"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vczyh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-11-24T06:57:36.000Z","updated_at":"2023-02-27T08:07:51.000Z","dependencies_parsed_at":"2024-06-20T17:33:26.477Z","dependency_job_id":"7052b443-638b-4228-bdcb-4861322b7fc0","html_url":"https://github.com/vczyh/dbinsert","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/vczyh/dbinsert","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vczyh%2Fdbinsert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vczyh%2Fdbinsert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vczyh%2Fdbinsert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vczyh%2Fdbinsert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vczyh","download_url":"https://codeload.github.com/vczyh/dbinsert/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vczyh%2Fdbinsert/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32003936,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["batch","bulk","db","insert"],"created_at":"2025-06-29T20:07:27.272Z","updated_at":"2026-04-19T10:31:10.220Z","avatar_url":"https://github.com/vczyh.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Features\n\n- 快速批量插入\n- 通过 `schmea` 自定义表结构，内置多种 `schema`\n- 根据字段类型自动生成数据\n- 快速生成多个库\n\n## Support\n\n- [MySQL](#MySQL)\n- [PostgreSQL](#PostgreSQL)\n- [Redis](#Redis)\n\n## Install\n\n从 [Releases](https://github.com/vczyh/dbinsert/releases) 下载，或者如果有 `go` 环境：\n\n```shell\ngo install github.com/vczyh/dbinsert@latest\n```\n\n```shell\ndbinsert version\n```\n\n## Schema\n\n`schema` 定义了表结构，不同的数据库会有不同，但对于关系数据库大体相同，可以使用 `--schema` 指定内置或者自定义 `schema`\n，如果不指定则使用默认 `schema`。\n\n支持 `schema` 的数据库：\n\n- MySQL\n- PostgreSQL\n\n## MySQL\n\n### MySQL Schema\n\n```json5\n[\n  {\n    // 数据库名称\n    \"database\": \"dbinsert\",\n    // 表名称\n    \"table\": \"tbl\",\n    // 插入 10000 条数据\n    \"size\": 10000,\n    // 主键\n    \"primaryKeyFieldNames\": [\n      \"id\"\n    ],\n    // 所有列\n    \"fields\": [\n      {\n        \"name\": \"id\",\n        \"type\": \"INT\",\n        // 是否自增\n        \"autoIncrement\": true\n      },\n      {\n        \"name\": \"name\",\n        \"type\": \"CHAR(60)\"\n      }\n    ]\n  },\n  // ... \n]\n```\n\n### 内置 schema\n\n- [`sysbench`](./relation/schema/sysbench_mysql.json)\n\n### Usage\n\n```shell\ndbinsert mysql \\\n  --host x.x.x.x \\ \n  --port 3306 \\\n  --user xxx  \\\n  --password xxx \\\n  --create-databases \\\n  --create-tables\n```\n\n### Flags\n\n| 名称                   | 默认                                                  | 说明                                         |\n|----------------------|-----------------------------------------------------|--------------------------------------------|\n| `--schema`           | [`sysbench`](./relation/schema/sysbench_mysql.json) | 内置或者自定义 `schema`                           |\n| `--host`             | `127.0.0.1`                                         | 域名或IP                                      |\n| `--port`             | `3306`                                              | 端口                                         |\n| `--username`         | `root`                                              | 用户                                         |\n| `--password`         | `\"\"`                                                | 密码                                         |\n| `--create-databases` | `false`                                             | 创建库如果不存在                                   |\n| `--create-tables`    | `false`                                             | 创建表如果不存在                                   |\n| `--table-size`       | `0`                                                 | 表记录条数，覆盖 `Schema` 中 `size`，`0` 不生效         |\n| `--timeout`          | `10h`                                               | 超时时间，`3m` 表示3分钟结束运行                        |\n| `--db-repeat`        | `0`                                                 | 数据库重复次数，会生成多个库 [`dbinsert_1`，`dbinsert_2`] |\n\n## PostgreSQL\n\n### PostgreSQL schema\n\n```json5\n[\n  {\n    // 数据库名称\n    \"database\": \"dbinsert\",\n    // 表名称\n    \"table\": \"tbl\",\n    // 插入 10000 条数据\n    \"size\": 10000,\n    // 主键\n    \"primaryKeyFieldNames\": [\n      \"id\"\n    ],\n    // 所有列\n    \"fields\": [\n      {\n        \"name\": \"id\",\n        \"type\": \"serial\"\n      },\n      {\n        \"name\": \"name\",\n        \"type\": \"CHAR(60)\"\n      }\n    ]\n  }\n]\n```\n\n### 内置 Schema\n\n- [`sysbench`](./relation/schema/sysbench_postgres.json)\n\n### Usage\n\n```shell\ndbinsert postgres \\\n  --host 100.100.1.194 \\ \n  --port 3306 \\\n  --user xxx \\\n  --password xxx \\\n  --create-databases \\\n  --create-tables\n```\n\n### Flags\n\n| 名称                   | 默认                                                     | 说明                                         |\n|----------------------|--------------------------------------------------------|--------------------------------------------|\n| `--schema`           | [`sysbench`](./relation/schema/sysbench_postgres.json) | 内置或者自定义 `schema`                           |\n| `--host`             | `127.0.0.1`                                            | 域名或IP                                      |\n| `--port`             | `5432`                                                 | 端口                                         |\n| `--username`         | `\"\"`                                                   | 用户                                         |\n| `--password`         | `\"\"`                                                   | 密码                                         |\n| `--create-databases` | `false`                                                | 创建库如果不存在                                   |\n| `--create-tables`    | `false`                                                | 创建表如果不存在                                   |\n| `--table-size`       | `0`                                                    | 表记录条数，覆盖 `Schema` 中 `size`，`0` 不生效         |\n| `--timeout`          | `10h`                                                  | 超时时间，`3m` 表示3分钟结束运行                        |\n| `--db-repeat`        | `0`                                                    | 数据库重复次数，会生成多个库 [`dbinsert_1`，`dbinsert_2`] |\n\n## Redis\n\n### Usage\n\n```shell\ndbinsert redis \\\n  --host 127.0.0.1 \\\n  --port 6379 \\\n  --user xxx \\\n  --password xxx \\  \n  --key-count 10000 \n```\n\n支持集群：\n\n```shell\ndbinsert redis \\\n  --cluster \\\n  --addrs 127.0.0.1:6379 \\\n  --user xxx \\\n  --password xxx  \\\n  --key-count 30000\n```\n\n### Flags\n\n| 名称            | 默认               | 支持类型  | 说明                  |\n|---------------|------------------|-------|---------------------|\n| `--user`      | `default`        | 单点和集群 | 用户                  |\n| `--password`  | `\"\"`             | 单点和集群 | 密码                  |\n| `--timeout`   | `10h`            | 单点和集群 | 超时时间，`3m` 表示3分钟结束运行 |\n| `--key-count` | `0`              | 单点和集群 | 插入的记录数, `0` 代表无限    |\n| `--value-len` | `50`             | 单点和集群 | `value` 字符串的长度      |\n| `--host`      | `127.0.0.1`      | 单点    | 域名或IP               |\n| `--port`      | `6379`           | 单点    | 端口                  |\n| `--cluster`   | `false`          | 集群    | 开启集群模式              |\n| `--addrs`     | `127.0.0.1:6379` | 集群    | 逗号分隔的集群地址列表         |","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvczyh%2Fdbinsert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvczyh%2Fdbinsert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvczyh%2Fdbinsert/lists"}