Skip to content

What is the best way to check if the size of a store is higher than a particular number? #3734

Answered by hmottestad
ate47 asked this question in Q&A
Discussion options

You must be logged in to vote

Size method typically uses getStatements, but needs to iterate over all the statements to count them. Since you are checking for an upper limit, then it will typically be faster to use getStatements the way you are doing because you can stop iterating once you hit your limit.

The size method could potentially have a faster implementation on some stores or under certain circumstances, but I don't that we are currently doing anything special here.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ate47
Comment options

Answer selected by ate47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants