subgraphs icon indicating copy to clipboard operation
subgraphs copied to clipboard

#bug; query liquidityPoolHourlySnapshots filter pool_in failed

Open guotie opened this issue 1 year ago • 2 comments

Describe the bug

when query liquidityPoolHourlySnapshots and where condition contain pool_in, the query timeout and failed

Reproduction Where can we see this bug in action? https://api.thegraph.com/subgraphs/name/messari/uniswap-v3-ethereum/graphql?query=query+MyQuery+%28%24poolIds%3A+%5BString%21%5D%29+%7B%0A++liquidityPoolHourlySnapshots%28where%3A+%7B+pool_in%3A+%24poolIds%7D%29+%7B%0A++++blockNumber%0A++++cumulativeVolumeByTokenAmount%0A++++timestamp%0A++++hour%0A++++cumulativeVolumeUSD%0A++++id%0A++++tick%0A++++pool+%7B%0A++++++inputTokens+%7B%0A++++++++decimals%0A++++++++name%0A++++++%7D%0A++++%7D%0A++%7D%0A%7D#

query MyQuery ($poolIds: [String!]) {
  liquidityPoolHourlySnapshots(where: { pool_in: $poolIds}) {
    blockNumber
    cumulativeVolumeByTokenAmount
    timestamp
    hour
    cumulativeVolumeUSD
    id
    tick
    pool {
      inputTokens {
        decimals
        name
      }
    }
  }
}

error:

{
  "errors": [
    {
      "message": "Failed to get entities from store: canceling statement due to statement timeout, query = /* controller='filter',application='sgd601088',route='a4e598b6b2364c9a-118644e74a101f44',action='19117630' */\nselect 'LiquidityPoolHourlySnapshot' as entity, to_jsonb(c.*) as data from (select  c.*\n  from \"sgd601088\".\"liquidity_pool_hourly_snapshot\" c\n where c.block$ <= $1 and (c.\"pool\" in ($2))\n\n order by \"id\"\n limit 100) c -- binds: [19117630, [136, 230, 160, 194, 221, 210, 111, 238, 182, 79, 3, 154, 44, 65, 41, 111, 203, 63, 86, 64]]"
    }
  ]
}

guotie avatar Jan 30 '24 06:01 guotie

I do not think anything is wrong with your query or our side. You are requesting too much data, so the query is timing out. You might need to add timestamp constraints, make the list of pools smaller, query the pools one by one, or use daily snapshots.

bye43 avatar Jan 30 '24 17:01 bye43

but it is only 1 query, no any other query, no concurrency

guotie avatar Jan 31 '24 03:01 guotie