Search code examples
sqlazureazure-data-explorerkqladx

How query data use offset in kusto (Azure Data Explorer) KQL for paging


How can I realize below SQL query use offset for paging query in KQL.

select * from testtable where code = '88580' limit 1000 offset 111

I can't find any function in KQL can like the offset in SQL


Solution

  • Note that for pagination Kusto has Stored query results which is used for pagination, and allows you to filter easily on the row numbers.

    I'm not aware of offset in KQL, but you can add a row_number, and filter by it:

    let testtable = datatable(code: int) [
        1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
        11, 12, 13, 14, 15
    ];
    testtable
    | where code > 0
    | serialize
    | extend _row=row_number()
    | limit 1000
    | where _row > 10