Forum Discussion

omygoodness's avatar
8 years ago

LiQL limited size of query

When I try to get results using LiQL for example SELECT * FROM messages I get only 25 results.

Is there global limit for size of query?

  • Yes, by default it is 25. However, you can pass the limit as LIMIT 100 or any number. Maximum is 1000. After that, you can paginate using OFFSET. More in the V2 API documentation.
  • Yes, by default it is 25. However, you can pass the limit as LIMIT 100 or any number. Maximum is 1000. After that, you can paginate using OFFSET. More in the V2 API documentation.
    • Liam_M's avatar
      Liam_M
      Guide

      Hi VarunGrazitti

      Does that mean that if I want to get all records where I don't know how many records there are, there isn't any way for me to do this, and the best I can do is to guess a ceiling and then do something like this:

       

      SELECT author.id FROM messages WHERE board.name = 'wireless' LIMIT 1000 OFFSET 0
      SELECT author.id FROM messages WHERE board.name = 'wireless' LIMIT 1000 OFFSET 1000
      SELECT author.id FROM messages WHERE board.name = 'wireless' LIMIT 1000 OFFSET 2000

      • Liam_M But why would you do that, it is easy for you to get the count first and then build your code on top of that, instead of doing the guess work.