{"id":20375937,"url":"https://github.com/stcarrez/sql-benchmark","last_synced_at":"2025-09-04T17:51:05.632Z","repository":{"id":37282120,"uuid":"154974297","full_name":"stcarrez/sql-benchmark","owner":"stcarrez","description":"Tool to make SQL benchmark on different drivers, languages and databases","archived":false,"fork":false,"pushed_at":"2022-09-08T00:42:39.000Z","size":237,"stargazers_count":30,"open_issues_count":3,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-26T02:51:08.250Z","etag":null,"topics":["ada","java","jdbc","mysql","postgresql","python","sql","sqlite"],"latest_commit_sha":null,"homepage":null,"language":"Ada","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stcarrez.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":"2018-10-27T14:35:30.000Z","updated_at":"2024-12-28T15:34:11.000Z","dependencies_parsed_at":"2023-01-17T14:16:19.521Z","dependency_job_id":null,"html_url":"https://github.com/stcarrez/sql-benchmark","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stcarrez%2Fsql-benchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stcarrez%2Fsql-benchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stcarrez%2Fsql-benchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stcarrez%2Fsql-benchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stcarrez","download_url":"https://codeload.github.com/stcarrez/sql-benchmark/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248535513,"owners_count":21120580,"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":["ada","java","jdbc","mysql","postgresql","python","sql","sqlite"],"created_at":"2024-11-15T01:34:16.695Z","updated_at":"2025-04-12T07:36:19.898Z","avatar_url":"https://github.com/stcarrez.png","language":"Ada","readme":"# Overview\n\nThe *sql-benchmark* provides simple benchmark of several database drivers in several languages.\nBenchmarks are intended to be simple so that they can be implemented easily for several\nlanguages and SQL databases.  Some of the goals are:\n\n* Evaluate the performance of a database driver,\n* Compare the performance of different languages when connecting to a database,\n* Have a rough comparison on simple SQL queries on different databases.\n\n# Languages\n\n* [Java Benchmark](https://github.com/stcarrez/sql-benchmark/tree/master/java)\n* [Ada Benchmark](https://github.com/stcarrez/sql-benchmark/tree/master/ado)\n* [Python Benchmark](https://github.com/stcarrez/sql-benchmark/tree/master/python)\n\n# Databases\n\nThree SQL databases are supported:\n\n* SQLite,\n* MySQL/MariaDB,\n* PostgreSQL\n\nBefore running the SQL benchmark of MySQL/MariaDB and PostgreSQL, you must create the\n`sqlbench` database and give access to the `sqlbench` user.\n\nThe SQLite database is created automatically.\n\n## MySQL/MariaDB setup\n\n1. Create the 'sqlbench' database in MySQL/MariaDB\n\n```\nmysql -u root\nmysql\u003e create database sqlbench;\n```\n\n2. Create the 'sqlbench' user:\n```\nmysql\u003e create user 'sqlbench'@'localhost' identified by 'sqlbench';\n```\n\n3. Give the access rights:\n```\nmysql\u003e grant select, insert, update, delete,\n       create, drop, create temporary tables, execute,\n       show view on sqlbench.* to sqlbench@'localhost';\nmysql\u003e flush privileges;\n```\n\n## Postgresql setup\n\nTo create manually the database, you can proceed to the following steps:\n\n1. Create the 'sqlbench' user and configure the password\n(enter 'sqlbench' for the password or update the configuration sqlbench.properties file):\n\n```\nsudo -u postgres createuser sqlbench --pwprompt\n```\n\n2. Create the 'sqlbench' database in Postgresql\n\n```\nsudo -u postgres createdb -O sqlbench sqlbench\n```\n\n# Running\n\nThe script `run-all.sh` can be used to run all the benchmark and produce the results.\nBefore running it, make sure you have built the Ada and Java benchmark programs as\nwell as the Ada aggregator tool.  To build, run the following commands.\n\n```\ncd ado\n./configure\nmake\ncd ../java\nmvn compile assembly:single\ncd ../tools\n./configure\nmake\ncd ..\n```\n\nThen, simply run the script:\n\n```\n./run-all.sh\n```\n\n# Results\n\n![Time](https://github.com/stcarrez/sql-benchmark/wiki/images/time.png)\n![Memory](https://github.com/stcarrez/sql-benchmark/wiki/images/memory.png)\n![SQLite](https://github.com/stcarrez/sql-benchmark/wiki/images/sqlite.png)\n![MySQL](https://github.com/stcarrez/sql-benchmark/wiki/images/mysql.png)\n![PostgreSQL](https://github.com/stcarrez/sql-benchmark/wiki/images/postgresql.png)\n\n\n## CONNECT; SELECT 1; CLOSE\n\n|                       | sqlite        | mysql         | postgresql    |\n|-----------------------|---------------|---------------|---------------|\n| Ada                   |  23.68 us     |  311.0 us     |  5.541 ms     |\n| Java                  |  187.7 us     |  895.8 us     |  10.80 ms     |\n| Python                |  42.00 us     |  398.5 us     |  6.071 ms     |\n\n## DO 1\n\n|                       | sqlite        | mysql         | postgresql    |\n|-----------------------|---------------|---------------|---------------|\n| Ada                   |               |  19.04 us     |               |\n| Java                  |               |  53.72 us     |               |\n| Python                |               |  33.03 us     |               |\n\n## DROP table; CREATE table\n\n|                       | sqlite        | mysql         | postgresql    |\n|-----------------------|---------------|---------------|---------------|\n| Ada                   |  216.9 us     |  496.2 ms     |  42.64 ms     |\n| Java                  |  1.698 ms     |  504.9 ms     |  45.03 ms     |\n| Python                |  122.5 ms     |  498.6 ms     |  41.24 ms     |\n\n## INSERT INTO table\n\n|                       | sqlite        | mysql         | postgresql    |\n|-----------------------|---------------|---------------|---------------|\n| Ada                   |  73.59 us     |  118.5 us     |  160.6 us     |\n| Java                  |  96.20 us     |  241.4 us     |  119.3 us     |\n| Python                |  3.684 us     |  290.7 us     |  119.1 us     |\n\n## SELECT * FROM table LIMIT 1\n\n|                       | sqlite        | mysql         | postgresql    |\n|-----------------------|---------------|---------------|---------------|\n| Ada                   |  25.63 us     |  75.60 us     |  105.5 us     |\n| Java                  |  5.096 us     |  97.38 us     |  105.6 us     |\n| Python                |  3.457 us     |  47.31 us     |  148.7 us     |\n\n## SELECT * FROM table LIMIT 10\n\n|                       | sqlite        | mysql         | postgresql    |\n|-----------------------|---------------|---------------|---------------|\n| Ada                   |  27.60 us     |  61.30 us     |  99.43 us     |\n| Java                  |  5.115 us     |  101.7 us     |  92.56 us     |\n| Python                |  8.766 us     |  51.76 us     |  128.0 us     |\n\n## SELECT * FROM table LIMIT 100\n\n|                       | sqlite        | mysql         | postgresql    |\n|-----------------------|---------------|---------------|---------------|\n| Ada                   |  37.41 us     |  131.1 us     |  161.6 us     |\n| Java                  |  15.53 us     |  174.5 us     |  223.8 us     |\n| Python                |  60.43 us     |  102.0 us     |  236.6 us     |\n\n## SELECT * FROM table LIMIT 500\n\n|                       | sqlite        | mysql         | postgresql    |\n|-----------------------|---------------|---------------|---------------|\n| Ada                   |  78.14 us     |  328.6 us     |  305.7 us     |\n| Java                  |  62.12 us     |  462.2 us     |  616.2 us     |\n| Python                |  297.8 us     |  300.2 us     |  462.2 us     |\n\n## SELECT * FROM table LIMIT 1000\n\n|                       | sqlite        | mysql         | postgresql    |\n|-----------------------|---------------|---------------|---------------|\n| Ada                   |  132.0 us     |  544.9 us     |  456.6 us     |\n| Java                  |  121.8 us     |  728.2 us     |  871.6 us     |\n| Python                |  605.6 us     |  551.6 us     |  730.3 us     |\n\n## SELECT 1\n\n|                       | sqlite        | mysql         | postgresql    |\n|-----------------------|---------------|---------------|---------------|\n| Ada                   |  9.501 us     |  35.60 us     |  87.55 us     |\n| Java                  |  5.629 us     |  70.61 us     |  104.4 us     |\n| Python                |  1.530 us     |  78.13 us     |  89.66 us     |\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstcarrez%2Fsql-benchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstcarrez%2Fsql-benchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstcarrez%2Fsql-benchmark/lists"}