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.

8 Replies

  • 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
    8 years ago

    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.
  • Liam_M's avatar
    Liam_M
    Guide
    8 years ago

    VarunGrazitti

    The code I've copied was just an example from the documentation. I'm actually trying get kudos by user. Kudos doesn't support count(*). So there's no way to get count.

    I can't use kudos_received from the user, because the reason I'm doing this is because we know that kudos_received isn't giving us the correct value, and we're trying to find out why.

  • VikasB's avatar
    VikasB
    Boss
    8 years ago

    Hi Liam_M  Here is the way to get the kudos count.
    Given

    SELECT kudos_given.sum(weight) FROM users WHERE id = '31'

    Received

    SELECT kudos_received.sum(weight) FROM users WHERE id = '31'

     

     

  • Liam_M's avatar
    Liam_M
    Guide
    8 years ago

    I can't use kudos_received from the user, because the reason I'm doing this is because we know that kudos_received isn't giving us the correct value, and we're trying to find out why.