Is it possible to use count and start in liststreamqueryitems?

+2 votes
I am currently trying to retrieve from a stream using multiple keys and publishers.

Is it possible to use count and start with listqueryitems?

If this is not possible, how do you recommend doing pagination with liststreamqueryitems?
asked Jul 24, 2019 by miozzz

1 Answer

0 votes

You cannot currently paginate the output of liststreamqueryitems because this would not be efficient in the same way as for other stream querying APIs. Unlike those other APIs, liststreamqueryitems isn't directly driven by an index, and requires a combination of indexing and item scanning to obtain its output.

How many items is this API returning to you, that makes you feel the need for pagination?

answered Jul 24, 2019 by MultiChain
Right now it is not returning a lot yet since the chain is still small but i am assuming it would be able to return up to 1000 items or more.

Would `liststreamqueryitems` always return the same list for the same query assuming that the chain has the same items?

right now i am using listreamqueryitems to list items from a stream with 2 specified keys. eventually my query would contain 2 keys and 1 publisher to narrow down the query.
Yes, it will always return the same list in the same order for the same chain.

Returning 1000 items is not a problem, but you may need to adjust the maxqueryscanitems runtime parameter, depending on how much any individual key or publisher is able to narrow the search down.
...