{"id":13722149,"url":"https://github.com/cvilsmeier/go-sqlite-bench","last_synced_at":"2026-01-16T20:34:23.915Z","repository":{"id":93777966,"uuid":"272250574","full_name":"cvilsmeier/go-sqlite-bench","owner":"cvilsmeier","description":"Benchmarks for Golang SQLite Drivers","archived":false,"fork":false,"pushed_at":"2025-08-23T14:17:06.000Z","size":1285,"stargazers_count":493,"open_issues_count":0,"forks_count":9,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-08-24T04:55:30.353Z","etag":null,"topics":["golang","sqlite"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cvilsmeier.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,"zenodo":null}},"created_at":"2020-06-14T17:26:50.000Z","updated_at":"2025-08-23T14:17:09.000Z","dependencies_parsed_at":"2024-11-14T11:32:40.876Z","dependency_job_id":"1bfb85ec-e846-4294-bb2f-20f7ec94d16f","html_url":"https://github.com/cvilsmeier/go-sqlite-bench","commit_stats":null,"previous_names":["cvilsmeier/go-sqlite-bench"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cvilsmeier/go-sqlite-bench","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvilsmeier%2Fgo-sqlite-bench","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvilsmeier%2Fgo-sqlite-bench/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvilsmeier%2Fgo-sqlite-bench/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvilsmeier%2Fgo-sqlite-bench/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cvilsmeier","download_url":"https://codeload.github.com/cvilsmeier/go-sqlite-bench/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvilsmeier%2Fgo-sqlite-bench/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28482267,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["golang","sqlite"],"created_at":"2024-08-03T01:01:25.090Z","updated_at":"2026-01-16T20:34:23.908Z","avatar_url":"https://github.com/cvilsmeier.png","language":"Go","readme":"Benchmarks for Golang SQLite Drivers\n==============================================================================\n\n\u003e [!NOTE]\n\u003e This work is sponsored by Monibot - Website, Server and Application Monitoring.\n\u003e Try out Monibot for free at [https://monibot.io](https://monibot.io?ref=go-sqlite-bench).\n\nFor benchmarks I used the following libraries:\n\n| Name     | Repository                                                                 | db/sql | cgo  | Remarks |\n| :---     | :---                                                                       | :---   | :--- | :---    |\n| bvinc    | [github.com/bvinc/go-sqlite-lite](https://github.com/bvinc/go-sqlite-lite) | -      | yes  | |\n| craw     | [github.com/crawshaw/sqlite](https://github.com/crawshaw/sqlite)           | -      | yes  | |\n| eaton    | [github.com/eatonphil/gosqlite](https://github.com/eatonphil/gosqlite)     | -      | yes  | (addded by @c4rlo) |\n| glebarez | [github.com/glebarez/go-sqlite](https://github.com/glebarez/go-sqlite)     | yes    | -    | Based on the modernc libraries (added by @dcarbone) |\n| mattn    | [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3)         | yes    | yes  | This library is (still) the de-facto standard and widely used. |\n| modernc  | [modernc.org/sqlite](https://modernc.org/sqlite)                           | yes    | -    | A pure Go solution, based on the SQLite C code transpiled to Go. |\n| ncruces  | [github.com/ncruces/go-sqlite3](https://github.com/ncruces/go-sqlite3)     | yes    | -    | A pure Go solution based on SQLite's WASM build and wazero. |\n| sqinn    | [github.com/cvilsmeier/sqinn-go](https://github.com/cvilsmeier/sqinn-go)   | -      | -    | A solution without CGO. It uses [github.com/cvilsmeier/sqinn](https://github.com/cvilsmeier/sqinn) to access SQLite database files. |\n| zombie   | [github.com/zombiezen/go-sqlite](https://github.com/zombiezen/go-sqlite)   | -      | -    | A pure-Go rewrite of the crawshaw driver, using the modernc libraries. |\n\nThe test setup is as follows:\n\n- OS: Debian/GNU Linux amd64 version 12.11\n- CPU: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz, 8 cores\n- RAM: 32GB\n- Disk: 1TB NVME SSD\n- go version go1.24.5 linux/amd64\n\nThe benchmark was run on 2025-08-17, with current library versions,\nsee go.mod file. Each test was run twice. The better result was then\nrecorded. This is not very scientific.\n\n\nA general note on benchmarks and this repository:\n------------------------------------------------------------------------------\n\nDo not trust benchmarks, write your own. This specific benchmark is modelled\nafter my very own database usage scenarios. Your scenarios may be totally\ndifferent.\n\nThis is also the reason this repository is open-source, but not open-contribution.\nThere are many good ideas to improve this benchmark: More driver libs, different\nlib versions, windows, macOS, different SQLite journal- and sync modes, etc.\n\nUnfortunately, supporting all this would take too much time for me.\nI read all proposals but have to, unfortunately, be very selective as to what\nto include in this project.\n\n\nDatabase Schema\n------------------------------------------------------------------------------\n\nThe test database consist of the following tables and indizes:\n\n    PRAGMA journal_mode=DELETE;\n    PRAGMA synchronous=FULL;\n    PRAGMA foreign_keys=1;\n    PRAGMA busy_timeout=5000;\n\n    CREATE TABLE users (\n        id INTEGER PRIMARY KEY NOT NULL,\n        created INTEGER NOT NULL,\n        email TEXT NOT NULL,\n        active INTEGER NOT NULL);\n    CREATE INDEX users_created ON users(created);\n\n    CREATE TABLE articles (\n        id INTEGER PRIMARY KEY NOT NULL,\n        created INTEGER NOT NULL,  \n        userId INTEGER NOT NULL REFERENCES users(id),\n        text TEXT NOT NULL);\n    CREATE INDEX articles_created ON articles(created);\n    CREATE INDEX articles_userId ON articles(userId);\n\n    CREATE TABLE comments (\n        id INTEGER PRIMARY KEY NOT NULL,\n        created INTEGER NOT NULL,\n        articleId INTEGER NOT NULL REFERENCES articles(id),\n        text TEXT NOT NULL);\n    CREATE INDEX comments_created ON comments(created);\n    CREATE INDEX comments_articleId ON comments(articleId);\n\n\nBenchmark Results\n------------------------------------------------------------------------------\n\nResult times are measured in milliseconds. Lower numbers indicate better\nperformance.\n\n\n### Simple\n\nInsert 1 million user rows in one database transaction.\nThen query all users once.\n\n![](results/simple.png)\n\n    Simple;      insert;  query;\n    bvinc;         1140;    574;\n    craw;          1173;    501;\n    eaton;         1107;    631;\n    glebarez;      5131;    761;\n    mattn;         1531;   1018;\n    modernc;       5288;    760;\n    ncruces;       3046;    910;\n    sqinn;          717;    247;\n    zombie;        1791;    264;\n\n\n### Real\n\nInsert 100 user with 20 articles per user and 20 comments per article.\nEach user is inserted in a separate transaction.\nThen query each user by email, and left-join articles and comments.\nThis benchmark is used to simulate real-world use cases.\n\n![](results/real.png)\n\n    Real;      insert;  query;\n    bvinc;       1166;     75;\n    craw;        1212;     58;\n    eaton;       1107;     80;\n    glebarez;    1673;    134;\n    mattn;       1416;    120;\n    modernc;     1641;    130;\n    ncruces;     1364;    127;\n    sqinn;       1236;     48;\n    zombie;      1762;     59;\n\n\n### Complex\n\nInsert 200 users in one database transaction.\nThen insert 20000 articles (100 articles for each user) in another transaction.\nThen insert 400000 comments (20 comments for each article) in another transaction.\nThen query all users, articles and comments in one big JOIN statement.\n\n![](results/complex.png)\n\n    Complex;     insert;  query;\n    bvinc;          701;    692;\n    craw;           699;    595;\n    eaton;          686;    756;\n    glebarez;      2918;   1093;\n    mattn;          843;   1187;\n    modernc;       2909;   1100;\n    ncruces;       1834;   1211;\n    sqinn;          457;    292;\n    zombie;        1286;    481;\n\n\n### Many\n\nInsert N users in one database transaction.\nThen query all users 1000 times.\nThis benchmark is used to simluate a read-heavy use case.\n\n![](results/many.png)\n\n    Many;        query/N=10; query/N=100; query/N=1000;\n    bvinc;               15;          66;          532;\n    craw;                13;          59;          499;\n    eaton;               24;          77;          584;\n    glebarez;            29;          90;          723;\n    mattn;               30;         111;         1000;\n    modernc;             30;          91;          736;\n    ncruces;             40;         116;          965;\n    sqinn;               40;          58;          339;\n    zombie;              15;          34;          218;\n\n\n### Large\n\nInsert 10000 users with N bytes of row content.\nThen query all users.\nThis benchmark is used to simluate reading of large (gigabytes) databases.\n\n![](results/large.png)\n\n    Large;       query/N=50000; query/N=100000; query/N=200000;\n    bvinc;                 149;            303;            560;\n    craw;                  167;            296;            574;\n    eaton;                 138;            227;            450;\n    glebarez;              404;            664;           1160;\n    mattn;                 131;            238;            449;\n    modernc;               387;            674;           1116;\n    ncruces;               171;            341;            648;\n    sqinn;                 292;            507;           1074;\n    zombie;                335;            591;           1000;\n\n\n### Concurrent\n\nInsert one million users.\nThen have N goroutines query all users.\nThis benchmark is used to simulate concurrent reads.\n\n![](results/concurrent.png)\n\n    Concurrent;  query/N=2; query/N=4; query/N=8;\n    bvinc;             686;       915;      1729;\n    craw;              586;       869;      1633;\n    eaton;             714;      1015;      1924;\n    glebarez;          856;      1182;      2177;\n    mattn;            1149;      1478;      2830;\n    modernc;           870;      1170;      2139;\n    ncruces;           982;      1300;      2516;\n    sqinn;             481;       668;      1224;\n    zombie;            323;       557;      1050;\n\n\nSummary\n------------------------------------------------------------------------------\n\n- We cannot declare a clear winner, it all depends on the use case.\n- SQLite without CGO is possible nowadays.\n","funding_links":[],"categories":["Go"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcvilsmeier%2Fgo-sqlite-bench","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcvilsmeier%2Fgo-sqlite-bench","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcvilsmeier%2Fgo-sqlite-bench/lists"}