Skip to content

Optimize TypeORM DB Usage#643

Closed
sorenjohanson wants to merge 11 commits into
b310-digital:mainfrom
sorenjohanson:593-optimize-typeorm-db-usage
Closed

Optimize TypeORM DB Usage#643
sorenjohanson wants to merge 11 commits into
b310-digital:mainfrom
sorenjohanson:593-optimize-typeorm-db-usage

Conversation

@sorenjohanson
Copy link
Copy Markdown
Contributor

Related to #593.

This PR adds an hourly logging mechanism for the database, which will show queries executed, most common query patterns and potential N+1 queries. It also adds the ability to log an analysis on the spot using getAnalysis(). The logger is very simple and file-based.

Here is an up to date analysis using the analyzer:
typeorm-analysis.log

I've decided to log the full stack trace when discovering potential N+1 queries because sometimes the actual file where the query is executed is at the top, sometimes at the bottom. It also logs the full query minus parameters in "Top 5 Query Patterns", so it's GDPR-compatible.

There are some obvious optimisations in the diff callbacks, some of which I've already implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants