Skip to content

Commit a4832f8

Browse files
committed
fix sql dbs in benchmark
1 parent e3c2194 commit a4832f8

File tree

7 files changed

+383
-212
lines changed

7 files changed

+383
-212
lines changed

TODO.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# TODO
22

33
- [ ] add more debug log messages
4+
- [ ] `sort` fields should be converted to `columnName`
5+
- [ ] in Knex if MSSQL and has offset but no sort, if should add a sort to the primaryKey field
6+
- [ ] https://github.com/knex/knex/issues/1527
47

58
## Actions
69
- [ ] `aggregate` action with params: `type: "sum", "avg", "count", "min", "max"` & `field: "price"`

benchmark/results/common/README.md

Lines changed: 43 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,22 @@ This is a common benchmark which create, list, get, update, replace and delete e
77
| Name | Adapter | Options |
88
| ---- | ------- | ------- |
99
| NeDB (memory) | NeDB | - |
10-
| MongoDB | MongoDB | `{"dbName":"bench-test","collection":"users"}` |
10+
| MongoDB | MongoDB | `{"dbName":"bench_test","collection":"users"}` |
1111
| Knex SQLite (memory) | Knex | `{"knex":{"client":"sqlite3","connection":{"filename":":memory:"},"useNullAsDefault":true,"log":{}}}` |
12+
| Knex-Postgresql | Knex | `{"knex":{"client":"pg","connection":{"host":"127.0.0.1","port":5432,"user":"postgres","password":"moleculer","database":"bench_test"}}}` |
1213
## Entity creation
1314

1415
### Result
1516

1617

1718
| Adapter config | Time | Diff | ops/sec |
1819
| -------------- | ----:| ----:| -------:|
19-
| NeDB (memory) | 64μs | 425.91% | 15,520.55 |
20-
| MongoDB | 338μs | 0% | 2,951.17 |
21-
| Knex SQLite (memory) | 317μs | 6.7% | 3,148.86 |
20+
| NeDB (memory) | 133μs | 616% | 7,509.97 |
21+
| MongoDB | 953μs | 0% | 1,048.88 |
22+
| Knex SQLite (memory) | 835μs | 14.04% | 1,196.19 |
23+
| Knex-Postgresql | 2ms | -59.06% | 429.44 |
2224

23-
![chart](https://image-charts.com/chart?chs=800x450&chtt=Entity%20creation%7C%28ops%2Fsec%29&chf=b0%2Clg%2C90%2C03a9f4%2C0%2C3f51b5%2C1&chg=0%2C50&chl=%7C%7C%7C%7C%2033%25%20%21%7Cx2%20&chma=0%2C0%2C10%2C10&cht=bvs&chxt=x%2Cy&chxl=0%3A%7CNeDB%20%28memory%29%7CMongoDB%7CKnex%20SQLite%20%28memory%29&chd=a%3A15520.550306087249%2C2951.1729033377355%2C3148.8573298599076)
25+
![chart](https://image-charts.com/chart?chs=800x450&chtt=Entity%20creation%7C%28ops%2Fsec%29&chf=b0%2Clg%2C90%2C03a9f4%2C0%2C3f51b5%2C1&chg=0%2C50&chl=%7C%7C%7C%7C%2033%25%20%21%7Cx2%20&chma=0%2C0%2C10%2C10&cht=bvs&chxt=x%2Cy&chxl=0%3A%7CNeDB%20%28memory%29%7CMongoDB%7CKnex%20SQLite%20%28memory%29%7CKnex-Postgresql&chd=a%3A7509.968502939131%2C1048.8813362999538%2C1196.193338627212%2C429.4365509567277)
2426

2527
## Entity finding
2628

@@ -29,11 +31,12 @@ This is a common benchmark which create, list, get, update, replace and delete e
2931

3032
| Adapter config | Time | Diff | ops/sec |
3133
| -------------- | ----:| ----:| -------:|
32-
| NeDB (memory) | 230μs | 159.83% | 4,332.09 |
33-
| MongoDB | 599μs | 0% | 1,667.25 |
34-
| Knex SQLite (memory) | 172μs | 248.5% | 5,810.35 |
34+
| NeDB (memory) | 550μs | 161.13% | 1,815.33 |
35+
| MongoDB | 1ms | 0% | 695.18 |
36+
| Knex SQLite (memory) | 761μs | 88.89% | 1,313.09 |
37+
| Knex-Postgresql | 1ms | 42.45% | 990.25 |
3538

36-
![chart](https://image-charts.com/chart?chs=800x450&chtt=Entity%20finding%7C%28ops%2Fsec%29&chf=b0%2Clg%2C90%2C03a9f4%2C0%2C3f51b5%2C1&chg=0%2C50&chl=%7C%7C%7C%7C%2033%25%20%21%7Cx2%20&chma=0%2C0%2C10%2C10&cht=bvs&chxt=x%2Cy&chxl=0%3A%7CNeDB%20%28memory%29%7CMongoDB%7CKnex%20SQLite%20%28memory%29&chd=a%3A4332.086400483569%2C1667.251594409789%2C5810.354334194111)
39+
![chart](https://image-charts.com/chart?chs=800x450&chtt=Entity%20finding%7C%28ops%2Fsec%29&chf=b0%2Clg%2C90%2C03a9f4%2C0%2C3f51b5%2C1&chg=0%2C50&chl=%7C%7C%7C%7C%2033%25%20%21%7Cx2%20&chma=0%2C0%2C10%2C10&cht=bvs&chxt=x%2Cy&chxl=0%3A%7CNeDB%20%28memory%29%7CMongoDB%7CKnex%20SQLite%20%28memory%29%7CKnex-Postgresql&chd=a%3A1815.3338412567227%2C695.176792798978%2C1313.0939965347168%2C990.2536308481683)
3740

3841
## Entity listing
3942

@@ -42,11 +45,12 @@ This is a common benchmark which create, list, get, update, replace and delete e
4245

4346
| Adapter config | Time | Diff | ops/sec |
4447
| -------------- | ----:| ----:| -------:|
45-
| NeDB (memory) | 1ms | 11.69% | 882.11 |
46-
| MongoDB | 1ms | 0% | 789.75 |
47-
| Knex SQLite (memory) | 578μs | 118.75% | 1,727.55 |
48+
| NeDB (memory) | 2ms | 27.39% | 440.88 |
49+
| MongoDB | 2ms | 0% | 346.09 |
50+
| Knex SQLite (memory) | 1ms | 172.68% | 943.73 |
51+
| Knex-Postgresql | 1ms | 64.58% | 569.59 |
4852

49-
![chart](https://image-charts.com/chart?chs=800x450&chtt=Entity%20listing%7C%28ops%2Fsec%29&chf=b0%2Clg%2C90%2C03a9f4%2C0%2C3f51b5%2C1&chg=0%2C50&chl=%7C%7C%7C%7C%2033%25%20%21%7Cx2%20&chma=0%2C0%2C10%2C10&cht=bvs&chxt=x%2Cy&chxl=0%3A%7CNeDB%20%28memory%29%7CMongoDB%7CKnex%20SQLite%20%28memory%29&chd=a%3A882.1061121640429%2C789.7534231862128%2C1727.554981836679)
53+
![chart](https://image-charts.com/chart?chs=800x450&chtt=Entity%20listing%7C%28ops%2Fsec%29&chf=b0%2Clg%2C90%2C03a9f4%2C0%2C3f51b5%2C1&chg=0%2C50&chl=%7C%7C%7C%7C%2033%25%20%21%7Cx2%20&chma=0%2C0%2C10%2C10&cht=bvs&chxt=x%2Cy&chxl=0%3A%7CNeDB%20%28memory%29%7CMongoDB%7CKnex%20SQLite%20%28memory%29%7CKnex-Postgresql&chd=a%3A440.8824042290265%2C346.0938734566868%2C943.7286496681418%2C569.5909821723836)
5054

5155
## Entity counting
5256

@@ -55,11 +59,12 @@ This is a common benchmark which create, list, get, update, replace and delete e
5559

5660
| Adapter config | Time | Diff | ops/sec |
5761
| -------------- | ----:| ----:| -------:|
58-
| NeDB (memory) | 1ms | -35.65% | 744.91 |
59-
| MongoDB | 863μs | 0% | 1,157.55 |
60-
| Knex SQLite (memory) | 145μs | 493.39% | 6,868.76 |
62+
| NeDB (memory) | 1ms | -19.12% | 568.27 |
63+
| MongoDB | 1ms | 0% | 702.57 |
64+
| Knex SQLite (memory) | 303μs | 368.37% | 3,290.68 |
65+
| Knex-Postgresql | 759μs | 87.38% | 1,316.49 |
6166

62-
![chart](https://image-charts.com/chart?chs=800x450&chtt=Entity%20counting%7C%28ops%2Fsec%29&chf=b0%2Clg%2C90%2C03a9f4%2C0%2C3f51b5%2C1&chg=0%2C50&chl=%7C%7C%7C%7C%2033%25%20%21%7Cx2%20&chma=0%2C0%2C10%2C10&cht=bvs&chxt=x%2Cy&chxl=0%3A%7CNeDB%20%28memory%29%7CMongoDB%7CKnex%20SQLite%20%28memory%29&chd=a%3A744.9083928418921%2C1157.5458931255625%2C6868.75566194105)
67+
![chart](https://image-charts.com/chart?chs=800x450&chtt=Entity%20counting%7C%28ops%2Fsec%29&chf=b0%2Clg%2C90%2C03a9f4%2C0%2C3f51b5%2C1&chg=0%2C50&chl=%7C%7C%7C%7C%2033%25%20%21%7Cx2%20&chma=0%2C0%2C10%2C10&cht=bvs&chxt=x%2Cy&chxl=0%3A%7CNeDB%20%28memory%29%7CMongoDB%7CKnex%20SQLite%20%28memory%29%7CKnex-Postgresql&chd=a%3A568.2729648602835%2C702.5746965267197%2C3290.6820611225803%2C1316.4920639696516)
6368

6469
## Entity getting
6570

@@ -68,11 +73,12 @@ This is a common benchmark which create, list, get, update, replace and delete e
6873

6974
| Adapter config | Time | Diff | ops/sec |
7075
| -------------- | ----:| ----:| -------:|
71-
| NeDB (memory) | 42μs | 548.17% | 23,614.31 |
72-
| MongoDB | 274μs | 0% | 3,643.24 |
73-
| Knex SQLite (memory) | 147μs | 86.5% | 6,794.62 |
76+
| NeDB (memory) | 68μs | 1,046.68% | 14,669.26 |
77+
| MongoDB | 781μs | 0% | 1,279.29 |
78+
| Knex SQLite (memory) | 409μs | 90.68% | 2,439.35 |
79+
| Knex-Postgresql | 784μs | -0.36% | 1,274.72 |
7480

75-
![chart](https://image-charts.com/chart?chs=800x450&chtt=Entity%20getting%7C%28ops%2Fsec%29&chf=b0%2Clg%2C90%2C03a9f4%2C0%2C3f51b5%2C1&chg=0%2C50&chl=%7C%7C%7C%7C%2033%25%20%21%7Cx2%20&chma=0%2C0%2C10%2C10&cht=bvs&chxt=x%2Cy&chxl=0%3A%7CNeDB%20%28memory%29%7CMongoDB%7CKnex%20SQLite%20%28memory%29&chd=a%3A23614.314041407346%2C3643.2353709526915%2C6794.6160807510105)
81+
![chart](https://image-charts.com/chart?chs=800x450&chtt=Entity%20getting%7C%28ops%2Fsec%29&chf=b0%2Clg%2C90%2C03a9f4%2C0%2C3f51b5%2C1&chg=0%2C50&chl=%7C%7C%7C%7C%2033%25%20%21%7Cx2%20&chma=0%2C0%2C10%2C10&cht=bvs&chxt=x%2Cy&chxl=0%3A%7CNeDB%20%28memory%29%7CMongoDB%7CKnex%20SQLite%20%28memory%29%7CKnex-Postgresql&chd=a%3A14669.259267409656%2C1279.286247049302%2C2439.3484180933215%2C1274.72016142048)
7682

7783
## Entity resolving
7884

@@ -81,11 +87,12 @@ This is a common benchmark which create, list, get, update, replace and delete e
8187

8288
| Adapter config | Time | Diff | ops/sec |
8389
| -------------- | ----:| ----:| -------:|
84-
| NeDB (memory) | 29μs | 859.91% | 34,345.73 |
85-
| MongoDB | 279μs | 0% | 3,578.02 |
86-
| Knex SQLite (memory) | 147μs | 89.24% | 6,771 |
90+
| NeDB (memory) | 67μs | 1,072.1% | 14,786.3 |
91+
| MongoDB | 792μs | 0% | 1,261.52 |
92+
| Knex SQLite (memory) | 349μs | 127.1% | 2,864.95 |
93+
| Knex-Postgresql | 755μs | 4.86% | 1,322.79 |
8794

88-
![chart](https://image-charts.com/chart?chs=800x450&chtt=Entity%20resolving%7C%28ops%2Fsec%29&chf=b0%2Clg%2C90%2C03a9f4%2C0%2C3f51b5%2C1&chg=0%2C50&chl=%7C%7C%7C%7C%2033%25%20%21%7Cx2%20&chma=0%2C0%2C10%2C10&cht=bvs&chxt=x%2Cy&chxl=0%3A%7CNeDB%20%28memory%29%7CMongoDB%7CKnex%20SQLite%20%28memory%29&chd=a%3A34345.730311534746%2C3578.02093301269%2C6770.997110974851)
95+
![chart](https://image-charts.com/chart?chs=800x450&chtt=Entity%20resolving%7C%28ops%2Fsec%29&chf=b0%2Clg%2C90%2C03a9f4%2C0%2C3f51b5%2C1&chg=0%2C50&chl=%7C%7C%7C%7C%2033%25%20%21%7Cx2%20&chma=0%2C0%2C10%2C10&cht=bvs&chxt=x%2Cy&chxl=0%3A%7CNeDB%20%28memory%29%7CMongoDB%7CKnex%20SQLite%20%28memory%29%7CKnex-Postgresql&chd=a%3A14786.301219406241%2C1261.5241435721416%2C2864.946312232579%2C1322.7911259662353)
8996

9097
## Entity updating
9198

@@ -94,11 +101,12 @@ This is a common benchmark which create, list, get, update, replace and delete e
94101

95102
| Adapter config | Time | Diff | ops/sec |
96103
| -------------- | ----:| ----:| -------:|
97-
| NeDB (memory) | 109μs | 406.39% | 9,112.3 |
98-
| MongoDB | 555μs | 0% | 1,799.46 |
99-
| Knex SQLite (memory) | 442μs | 25.72% | 2,262.27 |
104+
| NeDB (memory) | 218μs | 643% | 4,577.23 |
105+
| MongoDB | 1ms | 0% | 616.05 |
106+
| Knex SQLite (memory) | 1ms | 47.83% | 910.7 |
107+
| Knex-Postgresql | 2ms | -43.92% | 345.47 |
100108

101-
![chart](https://image-charts.com/chart?chs=800x450&chtt=Entity%20updating%7C%28ops%2Fsec%29&chf=b0%2Clg%2C90%2C03a9f4%2C0%2C3f51b5%2C1&chg=0%2C50&chl=%7C%7C%7C%7C%2033%25%20%21%7Cx2%20&chma=0%2C0%2C10%2C10&cht=bvs&chxt=x%2Cy&chxl=0%3A%7CNeDB%20%28memory%29%7CMongoDB%7CKnex%20SQLite%20%28memory%29&chd=a%3A9112.300486428467%2C1799.461996852181%2C2262.2660920100316)
109+
![chart](https://image-charts.com/chart?chs=800x450&chtt=Entity%20updating%7C%28ops%2Fsec%29&chf=b0%2Clg%2C90%2C03a9f4%2C0%2C3f51b5%2C1&chg=0%2C50&chl=%7C%7C%7C%7C%2033%25%20%21%7Cx2%20&chma=0%2C0%2C10%2C10&cht=bvs&chxt=x%2Cy&chxl=0%3A%7CNeDB%20%28memory%29%7CMongoDB%7CKnex%20SQLite%20%28memory%29%7CKnex-Postgresql&chd=a%3A4577.230110178461%2C616.0483041257492%2C910.7005648881625%2C345.4652494785996)
102110

103111
## Entity replacing
104112

@@ -107,24 +115,12 @@ This is a common benchmark which create, list, get, update, replace and delete e
107115

108116
| Adapter config | Time | Diff | ops/sec |
109117
| -------------- | ----:| ----:| -------:|
110-
| NeDB (memory) | 105μs | 441.04% | 9,480.95 |
111-
| MongoDB | 570μs | 0% | 1,752.37 |
112-
| Knex SQLite (memory) | 461μs | 23.77% | 2,168.99 |
118+
| NeDB (memory) | 211μs | 725.13% | 4,729.44 |
119+
| MongoDB | 1ms | 0% | 573.18 |
120+
| Knex SQLite (memory) | 1ms | 46.21% | 838.05 |
121+
| Knex-Postgresql | 3ms | -45.76% | 310.87 |
113122

114-
![chart](https://image-charts.com/chart?chs=800x450&chtt=Entity%20replacing%7C%28ops%2Fsec%29&chf=b0%2Clg%2C90%2C03a9f4%2C0%2C3f51b5%2C1&chg=0%2C50&chl=%7C%7C%7C%7C%2033%25%20%21%7Cx2%20&chma=0%2C0%2C10%2C10&cht=bvs&chxt=x%2Cy&chxl=0%3A%7CNeDB%20%28memory%29%7CMongoDB%7CKnex%20SQLite%20%28memory%29&chd=a%3A9480.946242971793%2C1752.367667765109%2C2168.991276066865)
115-
116-
## Entity deleting
117-
118-
### Result
119-
120-
121-
| Adapter config | Time | Diff | ops/sec |
122-
| -------------- | ----:| ----:| -------:|
123-
| NeDB (memory) | 171μs | -0.3% | 5,847.85 |
124-
| MongoDB | 170μs | 0% | 5,865.48 |
125-
| Knex SQLite (memory) | 1ms | -87.44% | 736.72 |
126-
127-
![chart](https://image-charts.com/chart?chs=800x450&chtt=Entity%20deleting%7C%28ops%2Fsec%29&chf=b0%2Clg%2C90%2C03a9f4%2C0%2C3f51b5%2C1&chg=0%2C50&chl=%7C%7C%7C%7C%2033%25%20%21%7Cx2%20&chma=0%2C0%2C10%2C10&cht=bvs&chxt=x%2Cy&chxl=0%3A%7CNeDB%20%28memory%29%7CMongoDB%7CKnex%20SQLite%20%28memory%29&chd=a%3A5847.848453652166%2C5865.476575255393%2C736.7163512064737)
123+
![chart](https://image-charts.com/chart?chs=800x450&chtt=Entity%20replacing%7C%28ops%2Fsec%29&chf=b0%2Clg%2C90%2C03a9f4%2C0%2C3f51b5%2C1&chg=0%2C50&chl=%7C%7C%7C%7C%2033%25%20%21%7Cx2%20&chma=0%2C0%2C10%2C10&cht=bvs&chxt=x%2Cy&chxl=0%3A%7CNeDB%20%28memory%29%7CMongoDB%7CKnex%20SQLite%20%28memory%29%7CKnex-Postgresql&chd=a%3A4729.43668174304%2C573.1761262639386%2C838.0454056487049%2C310.8743228991901)
128124

129125
--------------------
130-
_Generated at 2021-04-17T13:37:46.513Z_
126+
_Generated at 2021-04-17T17:14:37.684Z_

0 commit comments

Comments
 (0)