Orientdb: [FEATURE] Fetch Paginated Query Result with Total Count in Single Operation

Created on 10 Nov 2019  路  2Comments  路  Source: orientechnologies/orientdb

Hi
In some cases we need to have paginate data so we use traditionally combination of limit and skip like the below :

SELECT id,name,age FROM Person LIMIT 10 SKIP 5 WHERE age > 18

This query is works well but there is a enhancement required .

SELECT count(*) as total FROM Person  WHERE age > 18

In the several case we need the total count of the query . currently we must run two Query and merge the results .
Ideally i want to have total count of same query in a single query execution .
I recommend to have a feature in ODB to fetch paged data in single execution with the below syntax.

SELECT id,name,age FROM Person LIMIT 10 SKIP 5 WHERE age > 18 RETURN("WithTotal")

That returns following result schema :

{ "result": [arrayOfPaginatedData] , "total": 19500} 

Welcome to all comments .
Thanks
Saeed

enhancement

Most helpful comment

I'd like to vote for this issue also. We currently have user interfaces that have paginated tables, where you need a total result count for them to render the pagination control correctly. In all of these cases we are running two queries. One to get the results and one to get the count.

All 2 comments

Hi @saeedtabrizi

It sounds reasonable, I'm flagging it as an enhancement.
I cannot give you an ETA though

Thanks

Luigi

I'd like to vote for this issue also. We currently have user interfaces that have paginated tables, where you need a total result count for them to render the pagination control correctly. In all of these cases we are running two queries. One to get the results and one to get the count.

Was this page helpful?
0 / 5 - 0 ratings