{"id":21975216,"url":"https://github.com/huongnhdh/db_bench","last_synced_at":"2026-04-08T22:31:57.124Z","repository":{"id":112809354,"uuid":"185510698","full_name":"huongnhdh/db_bench","owner":"huongnhdh","description":null,"archived":false,"fork":false,"pushed_at":"2019-05-19T08:22:28.000Z","size":2065,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T23:42:52.249Z","etag":null,"topics":["database","performance-comparison","python-script"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/huongnhdh.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":"2019-05-08T02:13:09.000Z","updated_at":"2020-05-29T02:45:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"87b63d9f-1e25-401f-afea-90f98ec71e39","html_url":"https://github.com/huongnhdh/db_bench","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/huongnhdh/db_bench","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huongnhdh%2Fdb_bench","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huongnhdh%2Fdb_bench/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huongnhdh%2Fdb_bench/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huongnhdh%2Fdb_bench/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/huongnhdh","download_url":"https://codeload.github.com/huongnhdh/db_bench/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huongnhdh%2Fdb_bench/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31577444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["database","performance-comparison","python-script"],"created_at":"2024-11-29T15:50:20.450Z","updated_at":"2026-04-08T22:31:57.104Z","avatar_url":"https://github.com/huongnhdh.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Compare Database: MySQL, PostgreSQL, Maria DB (MongoDB with do later)\n## 1.How to benchmark\n### Step 1: Environment for test: \n\nsee at [docker](https://github.com/huongnhdh/db_bench/blob/master/docker.txt)\n\n| Database management system                                      | version | env |\n| ---------------------------------------------- | ------ | --- |\n| [Mysql](https://github.com/mysql/mysql-server) |      8.0  | [mysql image](https://hub.docker.com/_/mysql)    |\n| [MariaDB](https://github.com/MariaDB/server)   |       10.3 |  [MariaDB image](https://hub.docker.com/_/mariadb)   |\n| [PostgreSQL](https://github.com/postgres/postgres)|     11.2  | [Postgres image](https://hub.docker.com/_/postgres)     |\n| [MongoDB](https://github.com/mongodb/mongo)|    4.0.9    |  [Mongo image](https://hub.docker.com/_/mongo)   |\n\nThe ENV of running script is: Python 2.7 with Ubuntu 18.10 (SSD 128G)\n\n### Step 2: DataSet\n  A table has 3 column(1 random latin text, 2 random integer), without  index\n  see at:\n  - https://github.com/huongnhdh/db_bench/blob/master/sql/insert.sql\n  - https://github.com/huongnhdh/db_bench/blob/master/nosql/data.json\n\n### Step 3: Run some queries for measure time:\n\n  Please see at this link for more detail https://github.com/huongnhdh/db_bench/blob/master/benchmark.py\n  \n  - For read:  running 100 times on data-set 1.000.000 rows\n  - For write: running 100 times for bulk insert each time are 10.000 rows\n\n  | Query Type  | query 1 (q1)  | query 2 (q2)  | query 3 (q3)  | query 4(q4) |query 5 (q5) |query 6(q6)|\n  |---|---|---|---|---|---|---|  \n  | SQL  | `SELECT * FROM testing LIMIT 1000`  |`SELECT * FROM testing WHERE int_col \u003e 5000 LIMIT 1000`   |`SELECT * FROM testing WHERE int_col + int_col2 \u003e 12345 LIMIT 1000`   |`SELECT COUNT(*) FROM testing WHERE int_col + int_col2 \u003e 12345`   |`SELECT * FROM testing WHERE int_col \u003e 5000 ORDER BY word_col ASC LIMIT 1000`|`SELECT * FROM testing WHERE word_col LIKE '%lim%' ORDER BY word_col DESC LIMIT 1000`|\n  | MongoDB(NoSQL)  | `find().limit(1000) ` | `find({'int_col': {\"$gt\": 5000}}).limit(1000)`  |`aggregate.([{\"$addFields\":{\"sum\":{\"$sum\":[\"$int_col\",\"$int_col2\"]}}},{\"$match\":{\"sum\":{\"$gt\":12345}}},{\"$limit\": 1000}])`| `aggregate.([{\"$addFields\":{\"sum\":{\"$sum\":[\"$int_col\",\"$int_col2\"]}}},{\"$match\":{\"sum\":{\"$gt\":12345}}},{\"$count\": \"totalCount\"}])` |`find({'int_col': {\"$gt\": bson.int64.Int64(5000)}}).sort([(\"word_col\", pymongo.ASCENDING)]).limit(1000)`|`.find({\"word_col\":  \"/.*lim.*/\"}).sort([(\"word_col\", pymongo.DESCENDING)]).limit(1000)`|\n\n## 2. The report\n\n![report_mysql_postgresql_mariadb_mongo_db.png](report_mysql_postgresql_mariadb_mongo_db.png)\n\n\nNote: The images below was generate from report\n\nRaw summary result of avg execute 100 times:\n\n|Database management system  |Write batch data | q1 | q2 | q3 |q4 | q5 | q6|\n|---|---|---|---|---|---|---|---|\n|Mariadb-10.3| **`46.8200927734`**| 1.50604248047| 1.78776123047| 1.78776123047| 192.414335937| 301.729423828| 293.925852051|\n|Mongodb-4.0.9| 82.704220007 | **`0.0346118164063`**| **`0.0348852539062`**| **`0.0348852539062`**|1055.94130371| **`0.0642456054687`**| **`0.0800732421875`**|\n|Mysql-8.0| 75.0042041016| 2.2075| 2.18768066406| 2.18768066406| 177.359348145| 631.993063965| 406.15064209|\n|PostpreSQL-11.2| 66.9281835938| 1.25299072266| 1.53550048828| 1.73638427734| **`42.7281103516`**| 62.4191040039| 58.9514770508|\n\n\nThe raw of result at https://github.com/huongnhdh/db_bench/tree/master/benchmark\n\n## 3. Conclusion.\n- avg write time (batch insert): MariaDB win\n- q1: (`select` with `limit`): MongoDB win\n- q2: (`select` with `where` and `limit`): MongoDB win\n- q3: (`select` with `where(\u003e, +)` and `limit`): MongoDB win\n- q4: (`select` with `count` for `where( \u003c, + )`): PostgreSQL win\n- q5: (`select` with `where(\u003e )` `order by` and `asc` and `limit`): MongoDB win\n- q6: (`select` with `where(like)` `order by` and `asc` and `limit`): MongoDB win\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuongnhdh%2Fdb_bench","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuongnhdh%2Fdb_bench","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuongnhdh%2Fdb_bench/lists"}