# Ideal value for limit

**URL:** <https://community.bitquery.io/t/ideal-value-for-limit/401>\
**Category:** GraphQL API\
**Tags:** closed\
**Created:** [August 13, 2021, 4:21pm UTC](https://community.bitquery.io/t/ideal-value-for-limit/401 "2021-08-13T16:21:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vaibhav](https://avatars.discourse-cdn.com/v4/letter/v/c68b51/32.png) [@vaibhav](https://community.bitquery.io/u/vaibhav)\
**Post date:** [August 13, 2021, 4:21pm UTC](https://community.bitquery.io/t/ideal-value-for-limit/401/1 "2021-08-13T16:21:42Z")

</div>

I am using a job that queries the BitQueryAPI daily for getting price data. I have also made a paginated function that is supposed to query the full price history of a coin.

What is the supported maximum number of rows that can be returned in one API call defined by the `limit` parameter?

---

<div class="post-metadata">

**Author:** ![sayon](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@sayon](https://community.bitquery.io/u/sayon)\
**Post date:** [August 14, 2021, 12:28pm UTC](https://community.bitquery.io/t/ideal-value-for-limit/401/2 "2021-08-14T12:28:08Z")

</div>

The limit parameter basically limits your result to the amount “to be limited” passed along with it. If the limit has been set to 10, the API limits the returned data to 10 rows. The maximum number of rows returned in one API call defined by the limit parameter can be the total number of JSON formatted queries processed by the API i.e. basically the complete available data.

---

<div class="post-metadata">

**Author:** ![vaibhav](https://avatars.discourse-cdn.com/v4/letter/v/c68b51/32.png) [@vaibhav](https://community.bitquery.io/u/vaibhav)\
**Post date:** [August 16, 2021, 7:07am UTC](https://community.bitquery.io/t/ideal-value-for-limit/401/3 "2021-08-16T07:07:54Z")

</div>

@sayon When I try to execute queries using an API key with limit \> 10000, I went up getting errors, usually `Error 500: Bad Gateway` which go away when I reduce the limit. So my question is, what is the hard limit to how many rows can be queried from the API in one call for price data? Does this limit change for the paid API

---

<div class="post-metadata">

**Author:** ![gaurav](https://avatars.discourse-cdn.com/v4/letter/g/b487fb/32.png) [@gaurav](https://community.bitquery.io/u/gaurav)\
**Post date:** [August 16, 2021, 7:13am UTC](https://community.bitquery.io/t/ideal-value-for-limit/401/4 "2021-08-16T07:13:16Z")

</div>

There is no hard limit on how many rows can be queried, however, if you increase the limit, you will increase the server memory used while querying the data, which has limitations in the backend.

So there is no limit on how many rows can be queried (As of now), rather than there is a limit on how much memory will be used while querying the data in the backend.

---

<div class="post-metadata">

**Author:** ![vaibhav](https://avatars.discourse-cdn.com/v4/letter/v/c68b51/32.png) [@vaibhav](https://community.bitquery.io/u/vaibhav)\
**Post date:** [August 16, 2021, 7:25am UTC](https://community.bitquery.io/t/ideal-value-for-limit/401/5 "2021-08-16T07:25:51Z")

</div>

@gaurav so this also depends on the traffic on your backend I assume?

1. What is the limit on the memory that can be used? For example I would like to query the entire price history of the BNB coin, how many smaller requests should I break this into?
2. Can you give some insight into when (what time during the day) do you have the least load on your servers?
3. Are these memory constraints removed while using the paid API?

---

<div class="post-metadata">

**Author:** ![sayon](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@sayon](https://community.bitquery.io/u/sayon)\
**Post date:** [September 7, 2021, 11:29am UTC](https://community.bitquery.io/t/ideal-value-for-limit/401/6 "2021-09-07T11:29:28Z")

</div>

The memory constraints aren’t removed with the paid version. You have to optimize your query by setting limits and other filters.
