Skip to content

Instantly share code, notes, and snippets.

@t2y
Last active July 12, 2021 07:40
Show Gist options
  • Save t2y/6c9283cf620740a3c1fee5bb9ddfc800 to your computer and use it in GitHub Desktop.
Save t2y/6c9283cf620740a3c1fee5bb9ddfc800 to your computer and use it in GitHub Desktop.
TypeORM RelationId benchmark results

経過時間の単位はミリ秒。

Repository.find()

取得
件数
post1
(RelationIDあり, lazy=true)
post2
(RelationIDなし, lazy=true)
post3
(RelationIDなし, eager=true)
20 12 3 8
40 20 2 8
80 47 4 11
160 144 4 25
320 533 7 34
640 2,051 12 59
1,280 15,081 30 120
2,560 59,790 72 216

QueryBuilder.getMany()

取得
件数
post1
(RelationIDあり, lazy=true)
post2
(RelationIDなし, lazy=true)
post3
(RelationIDなし, eager=true)
20 8 2 1
40 17 5 2
80 40 3 2
160 135 5 2
320 506 6 5
640 1,980 11 9
1,280 14,669 45 22
2,560 58,961 45 36

QueryBuilder.getRawMany()

取得
件数
post1
(RelationIDあり, lazy=true)
post2
(RelationIDなし, lazy=true)
post3
(RelationIDなし, eager=true)
20 1 1 0
40 1 1 1
80 1 1 1
160 1 2 2
320 3 3 3
640 5 5 6
1,280 10 11 10
2,560 22 20 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment