-
Notifications
You must be signed in to change notification settings - Fork 6
[Tutorial] Compound indexing and query optimization #100
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
Conversation
## Conclusion | ||
|
||
By following these best practices and leveraging PowerSync's schema capabilities, developers can achieve significant performance gains and ensure scalability for their applications. | ||
The findings above can be integrated directly into PowerSync's documentation to assist other developers in navigating these challenges effectively. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this last note meant to be here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, copy pasta error. Thanks for catching
|
||
## Introduction | ||
|
||
This tutorial outlines findings and recommendations based on extensive testing of compound indexes, query execution, and table performance using the [PowerSync Web SDK](https://github.com/powersync-ja/powersync-js). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest to link to the SDK reference in docs since it's the higher-level starting point (and also includes link to source code): https://docs.powersync.com/client-sdk-references/javascript-web
I think this tutorial should be reworked a bit. The guide focuses on compound indexes, but does not explain (1) what a compound index is, or (2) when to use a compound index versus a single-column index. The performance benchmarks show the difference between using the index vs a table scan, but (1) does not give any details of how the benchmark was performed (e.g. number of table rows, number of results, the index used). The difference displayed us also quite small (206ms vs 556ms) - indexes can make a much bigger difference in some cases. And once again it doesn't show the difference compared to a single-column index, which could be a very small in this case. The guide mentions order of indexed columns affects query performance, and skipping leading columns affect performance, but it doesn't clarify what this means, or how it affects performance. The examples don't clarify much here. Overall, I'd recommend:
|
Thanks for the review @rkistner we're going to rework this guide. |
This needs to be revisited. Closing |
This PR adds a compound indexing and query optimization tutorial.