{"id":18276160,"url":"https://github.com/esgameco/py-db-benchmark","last_synced_at":"2025-08-01T15:43:29.995Z","repository":{"id":156969646,"uuid":"633218785","full_name":"esgameco/py-db-benchmark","owner":"esgameco","description":"A benchmarking tool to check how fast various python database drivers are.","archived":false,"fork":false,"pushed_at":"2023-04-27T06:24:13.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-11T07:23:16.843Z","etag":null,"topics":["aiosqlite","asyncpg","redis-py"],"latest_commit_sha":null,"homepage":"","language":"Python","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/esgameco.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":"2023-04-27T03:10:19.000Z","updated_at":"2023-04-27T06:49:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"8e3e4fef-d355-4706-a2d8-e0985dcc4762","html_url":"https://github.com/esgameco/py-db-benchmark","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/esgameco/py-db-benchmark","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esgameco%2Fpy-db-benchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esgameco%2Fpy-db-benchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esgameco%2Fpy-db-benchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esgameco%2Fpy-db-benchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/esgameco","download_url":"https://codeload.github.com/esgameco/py-db-benchmark/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esgameco%2Fpy-db-benchmark/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268254237,"owners_count":24220775,"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-01T02:00:08.611Z","response_time":67,"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":["aiosqlite","asyncpg","redis-py"],"created_at":"2024-11-05T12:15:08.675Z","updated_at":"2025-08-01T15:43:29.945Z","avatar_url":"https://github.com/esgameco.png","language":"Python","readme":"# py-db-benchmark\n\nA tool designed to benchmark various Python database drivers. Performance is also affected by how the database is setup.\n\n## Setup\n\n1.  ```bash\n    git clone https://github.com/esgameco/py-db-benchmark.git\n    pip install -r requirements.txt\n    ```\n2.  Set environment variables\n    - `export DB_POSTGRES=fill_in`\n    - `export DB_SQLITE=fill_in`\n    - `export DB_REDIS=fill_in`\n3. ```bash\n   python main.py\n   ```\n\n## Results (personal)\n\n- Postgres - asyncpg\n    ```bash\n    Average: 668.0549144744873 ms\n    b_create_pool: 626.9266366958618 ms\n    b_create_table: 13.405466079711914 ms\n    b_insert: 6.372976303100586 ms\n    b_update: 5.007719993591309 ms\n    b_get: 4.140663146972656 ms\n    b_delete_table: 5.392670631408691 ms\n    b_delete_pool: 6.808781623840332 ms\n    ```\n- SQLite - aiosqlite\n    ```bash\n    Average: 36.29621744155884 ms\n    b_create_table: 10.523924827575684 ms\n    b_insert: 6.109802722930908 ms\n    b_update: 3.7161803245544434 ms\n    b_get: 3.9947032928466797 ms\n    b_delete_table: 11.951606273651123 ms\n    ```\n- Redis - redis-py\n    ```bash\n    Average: 7.129123210906982 ms\n    b_create_pool: 0.5557537078857422 ms\n    b_insert: 3.8783669471740723 ms\n    b_update: 1.2389063835144043 ms\n    b_get: 1.4164018630981445 ms\n    b_delete_pool: 0.03969430923461914 ms\n    ```\n- Python - pycache (python list caching)\n    ```bash\n    Average: 0.022802615165710447 ms\n    b_insert: 0.011410260200500488 ms\n    b_update: 0.0055962085723876955 ms\n    b_get: 0.0057961463928222655 ms\n    ```\n\n## Notes\n\n- Postgres and Redis run on docker vms\n- Postgres uses connection pools which slow it down initially\n- Sqlite and redis not using pooling\n- This project was mainly for testing database performance for NPAPI, so tests were made with that in mind.\n\n## Conclusions\n\n- Use caching unless absolutely necessary","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesgameco%2Fpy-db-benchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fesgameco%2Fpy-db-benchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesgameco%2Fpy-db-benchmark/lists"}