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

perf: Add foreign key indexes to tables #887

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

Conversation

BobdenOs
Copy link
Contributor

@BobdenOs BobdenOs commented Nov 8, 2024

With the latest release of [email protected] the SQLite3 version was bumped to 3.47.0 (changes).

No attempt is made to create automatic indexes on a column that is known to be non-selective because of its use in other indexes that have been analyzed.

this seems to be the most important change for CAP applications as we create many join conditions using associations and compositions which SQLite3 tries to process to the best of its ability by creating temporary automatic indexes, but with this optimization the likeliness of these indexes being created is greatly reduced. Causing some of the more complex join queries to take 5000x longer then when using [email protected]. This PR tries to mitigate the effect of the reduced number of automatically generated indexes by using the model definition to provide explicit indexes for these modeled join condition sources / targets.

An example of the impact that providing explicit indexes has on complex SFlight requests:

analytics/Bookings?$expand=to_Travel($expand=CurrencyCode,TravelStatus,to_Agency,to_Customer,to_Booking),to_Carrier,to_Flight&$top=30
sqlite postgres hana
before ~50 req/s ~50 req/s ~140 req/s
after ~130 req/s ~110 req/s ~140 req/s

So while it doesn't have an impact on the HANA performance it provides additional optimization information for SQLite and Postgres. Closing the gap that SQLite and Postgres always have had when being compared with HANA for complex join heavy queries.

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