Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize TypeORM DB Usage #643

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

sorenjohanson
Copy link
Collaborator

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.

1 participant