{"id":18745639,"url":"https://github.com/jsstuff/xql-bench","last_synced_at":"2025-07-20T13:34:34.421Z","repository":{"id":22756033,"uuid":"26101551","full_name":"jsstuff/xql-bench","owner":"jsstuff","description":"A tool that measures performance of SQL query builders for node.js.","archived":false,"fork":false,"pushed_at":"2018-10-31T15:48:53.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-28T20:25:45.080Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/jsstuff.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-03T03:00:11.000Z","updated_at":"2018-10-31T15:48:55.000Z","dependencies_parsed_at":"2022-08-21T10:31:22.053Z","dependency_job_id":null,"html_url":"https://github.com/jsstuff/xql-bench","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/jsstuff%2Fxql-bench","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsstuff%2Fxql-bench/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsstuff%2Fxql-bench/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsstuff%2Fxql-bench/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsstuff","download_url":"https://codeload.github.com/jsstuff/xql-bench/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239627233,"owners_count":19670844,"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":[],"created_at":"2024-11-07T16:18:58.334Z","updated_at":"2025-02-19T09:20:01.646Z","avatar_url":"https://github.com/jsstuff.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"xql-bench\n==========\n\nA tool that measures performance of SQL query builders for node.js. It has been written to tune xql.js library, but more modules were included for comparison purposes.\n\n  * [Official Repository (jsstuff/xql-bench)](https://github.com/jsstuff/xql-bench)\n  * [Public Domain (unlicense.org)](http://unlicense.org)\n\nLibraries\n=========\n\nAt the moment these libraries are tested:\n\n  * knex\n  * sql-bricks\n  * squel\n  * xql\n  * Don't see your favorite library? Make a pull request!\n\n\nWhere `xql` and `knex` produce well formed output (strings are formatted and escaped), but `squel` doesn't seem to be escaping identifiers and values. The purpose of this tool is to benchmark and not to check for a proper escaping, however, libraries that don't escape by default are dangerous and have an advantage as escaping also costs some cycles.\n\nResults\n=======\n\nThese results were obtained on a development machine by running `node xql-bench.js`. The actual times are not important as these will vary depending on your CPU and node version, however, the comparison of times with other tests matters. The run is currently configured to build 100000 queries per test, but it can be modified by changing `Options.quantity`.\n\n```\nKnex 0.15.2\nSELECT_0: 1.227 [s]: select `a`, `b`, `c` from `x`\nSELECT_1: 1.514 [s]: select `a`, `b`, `c` from `x` where `enabled` = true limit 50 offset 100\nSELECT_2: 1.549 [s]: select `a`, `b`, `c` from `x` where `enabled` = false and `pending` = false and `blocked` = false\nSELECT_3: 1.701 [s]: select `x`.`a`, `x`.`b`, `y`.`c` from `x` inner join `y` on `x`.`uid` = `y`.`uid`\nINSERT_0: 1.343 [s]: insert into `x` (`a`, `b`, `c`) values (0, false, '''someText\"')\nUPDATE_0: 1.730 [s]: update `x` set `a` = 1, `b` = 2, `c` = '''\"?someStringToBeEscaped''' where `uid` = 1\nDELETE_0: 1.100 [s]: delete from `x` where `uid` \u003e= 1\n\nSqlBricks 2.0.3\nSELECT_0: 1.736 [s]: SELECT a, b, c FROM x\nSELECT_1: 2.114 [s]: SELECT a, b, c FROM x WHERE enabled = TRUE\nSELECT_2: 2.408 [s]: SELECT a, b, c FROM x WHERE enabled = FALSE AND pending = FALSE AND blocked = FALSE\nSELECT_3: 2.079 [s]: SELECT x.a, x.b, x.c FROM x LEFT JOIN y ON x.uid = y.uid\nINSERT_0: 1.020 [s]: INSERT INTO x (a, b, c) VALUES (0, FALSE, '''someText\"')\nUPDATE_0: 1.180 [s]: UPDATE x SET a = 1, b = 2, c = '''\"?someStringToBeEscaped''' WHERE uid = 1\nDELETE_0: 0.567 [s]: DELETE FROM x WHERE uid = 1\n\nSquel 5.12.2\nSELECT_0:20.905 [s]: SELECT a, b, c FROM x\nSELECT_1:21.648 [s]: SELECT a, b, c FROM x WHERE (enabled = TRUE) LIMIT 50 OFFSET 100\nSELECT_2:19.820 [s]: SELECT a, b, c FROM x WHERE (enabled = FALSE) AND (pending = FALSE) AND (blocked = FALSE)\nSELECT_3:19.500 [s]: SELECT x.a, x.b, x.c FROM x LEFT JOIN y `x.uid = y.uid`\nINSERT_0: 7.240 [s]: INSERT INTO x (a, b, c) VALUES (0, FALSE, ''someText\"')\nUPDATE_0:10.494 [s]: UPDATE x SET a = 1, b = 2, c = ''\"?someStringToBeEscaped'' WHERE (uid = 1)\nDELETE_0:11.295 [s]: DELETE FROM x WHERE (uid \u003e= 1)\n\nxql.js 1.4.3\nSELECT_0: 0.090 [s]: SELECT \"a\", \"b\", \"c\" FROM \"x\";\nSELECT_1: 0.193 [s]: SELECT \"a\", \"b\", \"c\" FROM \"x\" WHERE \"enabled\" = TRUE LIMIT 50 OFFSET 100;\nSELECT_2: 0.257 [s]: SELECT \"a\", \"b\", \"c\" FROM \"x\" WHERE \"enabled\" = FALSE AND \"pending\" = FALSE AND \"blocked\" = FALSE;\nSELECT_3: 0.275 [s]: SELECT \"x\".\"a\", \"x\".\"b\", \"y\".\"c\" FROM \"x\" INNER JOIN \"y\" ON \"x\".\"uid\" = \"y\".\"uid\";\nINSERT_0: 0.183 [s]: INSERT INTO \"x\" (\"a\", \"b\", \"c\") VALUES (0, FALSE, E'\\'someText\"');\nUPDATE_0: 0.255 [s]: UPDATE \"x\" SET \"a\" = 1, \"b\" = 2, \"c\" = E'\\'\"?someStringToBeEscaped\\'' WHERE \"uid\" = 1;\nDELETE_0: 0.110 [s]: DELETE FROM \"x\" WHERE \"uid\" \u003e= 1;\n```\n\nConclusion\n----------\n\nThe winner is clearly xql.js as it's many times faster than all other competing libraries. It seems that the xql.js is simply well-written from the performance standpoint. It also provides a lot of features and SQL constructs that other libraries don't offer or only offer through raw-query functionality (adding raw content to the query). The benchmarks were written in a way to not favor any library - they are simple by nature, but it's possible to add more complex queries in the future (and more engines).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsstuff%2Fxql-bench","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsstuff%2Fxql-bench","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsstuff%2Fxql-bench/lists"}