near / near-indexer-for-explorer

Watch NEAR network and store all the data from NEAR blockchain to PostgreSQL database
https://near-indexers.io/docs/projects/near-indexer-for-explorer
GNU General Public License v3.0
123 stars 56 forks source link

ERROR: canceling statement due to conflict with recovery Detail #295

Closed Bha91 closed 1 year ago

Bha91 commented 1 year ago

Hi, I'm getting this error for some not-long queries (~1 s). sometimes it runs without problem instantly and sometimes I got this: ERROR: canceling statement due to conflict with recovery Detail: User query might have needed to see row versions that must be removed this error is discussed here but all solutions need server-side changes, is there anything I can consider in writing query?

frol commented 1 year ago

There is nothing we can do to ensure fair use of the database. Can you share more details on your use-case?

Meanwhile, I can only suggest the following alternatives:

  1. Implement your own small indexer that will collect only the information you are interested in, you can do that in Rust, JS, or Python using NEAR Lake: https://near-indexers.io/tutorials/intro
  2. Run your own indexer-for-explorer (I suggest you use the fork that is based on NEAR Lake instead of using this repo as it will be much slimmer (cheaper to run): https://github.com/khorolets/near-indexer-for-explorer), but keep in mind that when you run it in “strict mode”, it requires the whole blockchain history synced into the database as otherwise it will retry indefinitely searching for things that are missing, but in “non-strict mode” you will not get accounts and access keys indexed.
  3. If your query is related to FT, NFT, or native balances, wait for Enhanced API release in September, which will provide RESTful APIs for the common requests