Skip to content

Latest commit

 

History

History
81 lines (65 loc) · 2.28 KB

File metadata and controls

81 lines (65 loc) · 2.28 KB

typeorm-performance-issues-sample

Sample application for typeorm peformance

configure database environment and create test data

$ docker-compose up -d
$ yarn dbinit
initialize tables and create data
...
Done in 11.81s.
$ docker-compose exec postgres psql -h localhost -U root test
psql (12.7)
test=# \d
                   List of relations
 Schema |            Name            |   Type   | Owner
--------+----------------------------+----------+-------
 public | attach                     | table    | root
 public | attach_id_seq              | sequence | root
 public | category                   | table    | root
 public | category4                  | table    | root
 public | category4_id_seq           | sequence | root
 public | category_id_seq            | sequence | root
 public | comment                    | table    | root
 public | comment_id_seq             | sequence | root
 public | post1                      | table    | root
 public | post1_categories_category  | table    | root
 public | post1_id_seq               | sequence | root
 public | post2                      | table    | root
 public | post2_categories_category  | table    | root
 public | post2_id_seq               | sequence | root
 public | post3                      | table    | root
 public | post3_categories_category  | table    | root
 public | post3_id_seq               | sequence | root
 public | post4                      | table    | root
 public | post4_categories_category4 | table    | root
 public | post4_id_seq               | sequence | root
 public | user                       | table    | root
 public | user_id_seq                | sequence | root
(22 rows)

Benchmark

Run RelationId related benchmakrs

$ yarn test --testNamePattern RelationId

Results

Run server application to inspect heap memory usage

$ yarn memoryProfile
Debugger listening on ws://127.0.0.1:9229/d47fd7ee-d7a6-418b-a329-66de1b4466a6
...

Run Distinct with relations query

$ env DEBUG=true yarn test --testNamePattern "Distinct"

Run Bulk insert benchmarks

$ yarn test --testNamePattern "Bulk create 1000 articles 100 times"
$ bash tests/bulk/psql.sh