# How to handle TOO\_MANY\_ROWS\_OR\_BYTES?

**URL:** <https://community.bitquery.io/t/how-to-handle-too-many-rows-or-bytes/1733>\
**Category:** GraphQL API\
**Tags:** support\
**Created:** [November 18, 2023, 9:33am UTC](https://community.bitquery.io/t/how-to-handle-too-many-rows-or-bytes/1733 "2023-11-18T09:33:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![blockson](https://sea2.discourse-cdn.com/flex016/user_avatar/community.bitquery.io/blockson/32/824_2.png) [@blockson](https://community.bitquery.io/u/blockson)\
**Post date:** [November 18, 2023, 9:33am UTC](https://community.bitquery.io/t/how-to-handle-too-many-rows-or-bytes/1733/1 "2023-11-18T09:33:07Z")

</div>

I have this query where Im interested to get a:

1. All swap prices on a very first block after liquidity adding
2. Price in every block in a timeframe up to 1 year _(if there’s swap in a block ocurred)_

But of course there is rate limits for some tokens:

```auto
"message": "clickhouse return status 500 [500 Internal Server Error] response Code: 396. DB::Exception: Limit for result exceeded, max rows: 25.00 thousand, current rows: 65.41 thousand. (TOO_MANY_ROWS_OR_BYTES) (version 23.7.5.30 (official build))\n",

```

Is there any ways to structure the call another way, to fulfill my goal?

```auto
{
	EVM(dataset: archive, network: eth) {
		DEXTrades(
			limitBy: { by: Block_Time, count: 2500000 }
			limit: { count: 2500000 }
			orderBy: { ascending: Block_Time }
			where: {
				Trade: {
					Buy: {
						Currency: {
							SmartContract: {
								is: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
							}
						}
					}
					Sell: {
						Currency: {
							SmartContract: {
								is: "0x8390a1DA07E376ef7aDd4Be859BA74Fb83aA02D5"
							}
						}
					}
				}
			}
		) {
			Trade {
				Buy {
					Price
					Currency {
						SmartContract
						Name
					}
				}
				Sell {
					Currency {
						Name
					}
				}
			}
			Block {
				Time
				Number
			}
			Transaction {
				Hash
			}
		}
	}
}

```

---

<div class="post-metadata">

**Author:** ![Divya](https://avatars.discourse-cdn.com/v4/letter/d/13edae/32.png) [@Divya](https://community.bitquery.io/u/Divya)\
**Post date:** [November 24, 2023, 5:30am UTC](https://community.bitquery.io/t/how-to-handle-too-many-rows-or-bytes/1733/2 "2023-11-24T05:30:27Z")

</div>

this criteria is used wrong

```auto
limitBy: {by: Block_Time, count: 2500000}

```

`limitby` limits by the field you’re mentioning, in this case, it will get 25k records for each block timestamp. That is too much data to query in one go.

---

<div class="post-metadata">

**Author:** ![blockson](https://sea2.discourse-cdn.com/flex016/user_avatar/community.bitquery.io/blockson/32/824_2.png) [@blockson](https://community.bitquery.io/u/blockson)\
**Post date:** [November 24, 2023, 11:15am UTC](https://community.bitquery.io/t/how-to-handle-too-many-rows-or-bytes/1733/3 "2023-11-24T11:15:47Z")

</div>

Thank you

So now it’s minimized from 65 to 32 thousand but still exceeded the limit of 25.

So there’s no way to fetch all time ATH of LP pair in one call?

---

<div class="post-metadata">

**Author:** ![bigpp6669](https://avatars.discourse-cdn.com/v4/letter/b/c57346/32.png) [@bigpp6669](https://community.bitquery.io/u/bigpp6669)\
**Post date:** [November 28, 2023, 9:14am UTC](https://community.bitquery.io/t/how-to-handle-too-many-rows-or-bytes/1733/4 "2023-11-28T09:14:18Z")

</div>

No, you have use the APIs using the time range or block range and then aggregate the data on your local machine
