mirror of
https://github.com/appy-one/acebase.git
synced 2026-05-25 06:02:14 -06:00
[GH-ISSUE #190] .sort causes each item to be read again #91
Labels
No labels
IndexedDB
browser
bug
dependencies
documentation
duplicate
enhancement
feature request
indexes
indexes
invalid
pull-request
query
question
transaction logging
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/acebase#91
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @meaningg on GitHub (Dec 17, 2022).
Original GitHub issue: https://github.com/appy-one/acebase/issues/190
.sort causes each item to be read from the database a second time - is it okay ?
with .sort

without .sort

@appy-one commented on GitHub (Dec 19, 2022):
It's a bit hard to say without the rest of your code, but if you are using
sortin combination withtakeandskip, it will first need to determine which nodes should be loaded for the result set. If you have no index on the target sort column(s), it needs to perform a "table scan" to read all sort column(s) values. Then, it will read all requested data from nodes that are in thetake/skipwindow: those records will have effectively been read twice.Without
sort, usingtake/skipis a as easy as just skipping n child nodes, then reading m nodes once@meaningg commented on GitHub (Dec 19, 2022):
Yes, I use a combination of .sort and .take. Now that explains it all. Thank you!
@appy-one commented on GitHub (Dec 19, 2022):
You're welcome!