iroha icon indicating copy to clipboard operation
iroha copied to clipboard

Query sorting support for pagination

Open gv-timur opened this issue 3 years ago • 5 comments

Add support for sorting query results in Iroha2 before applying pagination (start, limit). For example add multiple assets of type "AssetValueType.Store" and then query top 5 sorted by some value in Metadata.

gv-timur avatar May 30 '22 09:05 gv-timur

This is very likely going to be a wontfix.

Server side sorting for all queries is very likely to cause major abuse from users.

Best we can do is allow sorting in middleware that communicates with an Iroha peer.

appetrosyan avatar Jul 25 '22 11:07 appetrosyan

This looks like a duplicate of #2501.

pesterev avatar Jul 26 '22 19:07 pesterev

@appetrosyan I suggested a decision some time ago. This is based on sorting assets by timestamps in a b-tree map. It seems your suggestion is very similar but would force the sorting of assets on every request.

pesterev avatar Jul 26 '22 19:07 pesterev

So the approach that you propose is going to more than double the size of a structure that is already going to account for 80% of all traffic inside a block. We've had to go to extreme lengths to reduce the size previously.

appetrosyan avatar Jul 28 '22 08:07 appetrosyan

it will be solved here (#2553).

pesterev avatar Jul 30 '22 19:07 pesterev