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

feat: add index to avoid performance degradation #1606

Merged
merged 4 commits into from
Aug 7, 2024

Conversation

a67793581
Copy link
Contributor

@a67793581 a67793581 commented Aug 2, 2024

Purpose of the Pull Request
This pull request introduces database indexing improvements which significantly enhance performance in the production environment.
How to Test
To validate the changes:
Ensure the development environment is set up and running.
Apply the database migrations included in this PR.
Run the application and perform typical operations that involve querying the indexed data.
Use profiling tools (e.g., python -m cProfile) to measure the performance before and after applying the index.
Expected outcomes:
Queries involving the indexed fields should execute faster.
Profiling results should show a decrease in query execution time.
Have You Tested This PR?
Yes, I have tested the latest commit on this PR.

Before applying the index

img_v3_02dc_386f48e0-2d2c-4903-b219-b129ce7b97hu

After applying the index

img_v3_02dc_fab12b19-7fc7-4d42-993b-3cc8ad0c13hu

Related Issues or PRs

Is Your PR Over 500 Lines of Code?
No, this PR includes under 500 lines of code.
Additional Context
The performance improvement was observed in our production environment after deploying these changes. The indexing strategy was carefully designed to optimize frequently used queries without impacting write performance.

@a67793581 a67793581 changed the title Index No indexes lead to performance degradation Aug 2, 2024
@sarahwooders sarahwooders self-requested a review August 2, 2024 16:52
@sarahwooders sarahwooders changed the title No indexes lead to performance degradation feat: add index to avoid performance degradation Aug 2, 2024
Copy link
Collaborator

@sarahwooders sarahwooders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this! Could you please fix the formatting with poetry run black . -l 140?

@a67793581
Copy link
Contributor Author

Thanks for adding this! Could you please fix the formatting with poetry run black . -l 140?感谢您添加此内容!你能用诗歌运行黑色来修复格式吗. -l 140

Thanks for adding this! Could you please fix the formatting with poetry run black . -l 140?

I'll try

@sarahwooders sarahwooders self-requested a review August 7, 2024 05:09
Copy link
Collaborator

@sarahwooders sarahwooders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great - thanks for the contribution!

@sarahwooders sarahwooders merged commit bbe37fc into letta-ai:main Aug 7, 2024
9 of 11 checks passed
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