snappydata icon indicating copy to clipboard operation
snappydata copied to clipboard

how to use offset in sql

Open gangly opened this issue 5 years ago • 3 comments

I want to query data from snappydata using sql, like this: select * from tableA limit 10, 20; or select * from tableA limit 20 offset 10;

and find error.

Does snappydata not support offset ?

gangly avatar Jul 23 '19 10:07 gangly

Hi Gary - OFFSET is not supported yet. We plan to bring it in at some point soon though we can't give you an exact date now.

kneeraj avatar Jul 23 '19 10:07 kneeraj

“select * from (select row_number() over (order by id desc) rn, * from table) where rn between 1 and 10” it works 李刚大佬好🌚

TeslaCN avatar Aug 28 '19 07:08 TeslaCN

this is likely quite expensive if the table is large. A better approach is to use monotonically_increasing_id() function to inject a id column into your table at load time. And, later use this to select the required range.


Jags SnappyData acquired by TIBCO http://snappydata.io Download binary, source https://www.snappydata.io/download

On Wed, Aug 28, 2019 at 12:28 AM 吴伟杰 [email protected] wrote:

“select * from (select row_number() over (order by id desc) rn, * from table) where rn between 1 and 10” it works 李刚大佬好🌚

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/SnappyDataInc/snappydata/issues/1369?email_source=notifications&email_token=AAOYUBXVOJDLCFWI3DEG3ODQGYSIFA5CNFSM4IGCQNI2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5KFDRQ#issuecomment-525619654, or mute the thread https://github.com/notifications/unsubscribe-auth/AAOYUBVDUI7ZJ3JWYSP5EELQGYSIFANCNFSM4IGCQNIQ .

jramnara avatar Aug 28 '19 15:08 jramnara