{"id":19683887,"url":"https://github.com/prisma/orm-benchmarks","last_synced_at":"2025-08-15T23:13:57.035Z","repository":{"id":246519717,"uuid":"821325571","full_name":"prisma/orm-benchmarks","owner":"prisma","description":"Benchmark application to compare query latency of TypeScript ORMs.","archived":false,"fork":false,"pushed_at":"2025-04-11T10:58:45.000Z","size":30996,"stargazers_count":19,"open_issues_count":3,"forks_count":4,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-08-08T21:10:56.296Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://benchmarks.prisma.io","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prisma.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,"zenodo":null}},"created_at":"2024-06-28T09:37:46.000Z","updated_at":"2025-07-20T00:02:54.000Z","dependencies_parsed_at":"2024-06-28T12:56:33.585Z","dependency_job_id":"672e9af2-bb63-4ced-a3c8-0b48635c8225","html_url":"https://github.com/prisma/orm-benchmarks","commit_stats":null,"previous_names":["nikolasburk/bench","prisma/orm-benchmarks"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/prisma/orm-benchmarks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prisma%2Form-benchmarks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prisma%2Form-benchmarks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prisma%2Form-benchmarks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prisma%2Form-benchmarks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prisma","download_url":"https://codeload.github.com/prisma/orm-benchmarks/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prisma%2Form-benchmarks/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270644765,"owners_count":24621332,"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","status":"online","status_checked_at":"2025-08-15T02:00:12.559Z","response_time":110,"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":[],"created_at":"2024-11-11T18:15:59.085Z","updated_at":"2025-08-15T23:13:57.011Z","avatar_url":"https://github.com/prisma.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](./header.png)\n\n\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003eORM Benchmarks\u003c/h1\u003e\n\u003c/div\u003e\n\nThis repo contains the app that was used to collect the data for [ORM benchmarks](https://benchmarks.prisma.io). \n\nYou can learn more about the benchmark methodology and results in this blog post: [Performance Benchmarks: Comparing Query Latency across TypeScript ORMs \u0026 Databases](https://www.prisma.io/blog/performance-benchmarks-comparing-query-latency-across-typescript-orms-and-databases).\n\n## Setup\n\n### 1. Set up the repo\n\nClone the repo, navigate into it and install dependencies:\n\n```\ngit clone git@github.com:prisma/orm-benchmarks.git\ncd orm-benchmarks\nnpm install\n```\n\n### 2. Configure database connection\n\nSet the `DATABASE_URL` environment variable to your database connection string in a `.env` file.\n\nFirst, create a `.env` file:\n\n```bash\ntouch .env\n```\n\nThen open the `.env` file and add the following line:\n\n```bash\nDATABASE_URL=\"your-database-url\"\n```\n\nFor example:\n\n```bash\nDATABASE_URL=\"postgresql://user:password@host:port/db\"\n```\n\n\u003cdetails\u003e\u003csummary\u003eAlternative: Set the \u003ccode\u003eDATABASE_URL\u003c/code\u003e in the terminal\u003c/summary\u003e\n\nAlternatively, you can set the `DATABASE_URL` in the terminal:\n\n```bash\nexport DATABASE_URL=\"postgresql://user:password@host:port/db\"\n```\n\n\u003c/details\u003e\n\n### 3. Run database migration\n\nTo create the database and the schema, run the `prisma db push` command by pointing it to the schema of your database.\n\n#### PostgreSQL\n\nIf you use PostgreSQL, run:\n\n```\nnpx prisma db push --schema ./prisma-pg/schema.prisma\n```\n\n\u003e **Note**: We may add more databases in the future.\n\n### 4. Run the benchmarks\n\n\u003e **Note for PostgreSQL**: Since the data preparation/seeding relies on `pg_dump` and `pg_restore`, the PostgreSQL versions of the machine that's executing the script must match the version of the target PostgreSQL server.\n\n```\nsh ./benchmark.sh -i 500 -s 1000 \n```\n\nThis executes the benchmark scripts with 500 iterations and a sample size of 1000 records per table. See below for the different options you can provide to any benchmark runs.\n\nThe results of the benchmark run will be stored in a folder called `results/DB-SIZE-ITERATIONS-TIMESTAMP`, e.g. `results/postgresql-1000-500-1721027353940`. This folder will have one `.csv` file per ORM, e.g.:\n\n```\nresults/postgresql-1000-500-1721027353940\n├── drizzle.csv\n├── prisma.csv\n└── typeorm.csv\n```\n\n## Usage\n\n### Executing the benchmarks\n\nYou can execute the benchmarks by running the [`benchmark.sh`](./benchmark.sh):\n\n```\nsh ./benchmark.sh [options]\n```\n\n### Options\n\nYou can provide the following options to the script:\n\n| Name             | Short | Default | Description                                        | Required |\n| ---------------- | ----- | ------- | -------------------------------------------------- | -------- |\n| `--iterations`   | `-i`  | 2       | Number of times to execute the benchmarks          | No       |\n| `--size`         | `-s`  | 50      | Size of the data set (number of records per table) | No       |\n| `--database-url` | `-d`  | n/a     | Database connection string                         | No       |\n\nFor example:\n\n```\nsh ./benchmark.sh -i 500 -s 1000 --database-url postgresql://user:password@host:port/db\n```\n\n## Debugging\n\nYou can turn on two debug setting via the `DEBUG` environment variable:\n\n- `benchmarks:compare-results`: Compare the results at the end of each benchmark run. Note that this approach will consume more memory because the results of all executed queries are collected.\n\n## Notes\n\n- This repo contains an unfinished MySQL implementation.\n- The final results that are published on [`benchmarks.prisma.io`](https://benchmarks.prisma.io) are based on the data in [`./results-website`](./results-website).\n- The script in [`./src/lib/website-output.ts`](./src/lib/website-output.ts) is used to generate the JSON structures that are the basis for the result visualisation in [`benchmarks.prisma.io`](https://benchmarks.prisma.io).\n- For Postgres, there are two ways how the seeding is implemented:\n  - Option 1: Seed data with Prisma Client's `createMany` query (implemented in [./src/lib/prepare-pg-prisma.ts](./src/lib/prepare-pg-prisma.ts))\n  - Option 2: Seed data with Prisma Client's `createMany` query only once, then store a DB dump in `./data/...` and restore the dump upon subsequent invocations (implemented in [./src/lib/prepare-pg-native.ts](./src/lib/prepare-pg-native.ts))","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprisma%2Form-benchmarks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprisma%2Form-benchmarks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprisma%2Form-benchmarks/lists"}