Facing issue while querying data with too many filter values

Hi everyone,

I'm getting an error while querying data. Scenario here is logged in user will have multiple countries associated. so when user logs in we are fetching loggedin user counties and  passing the list of country id's to the view to get data. when user having upto 70 countries it is working fine but when exceeds it is throwing error. Can anyone please help me how to resolve the issue. 

PFA image

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    When you query a view, I suspect a timeout. Try to optimize that view.

    Did you consider to use a single filter using the "IN" operator instead of adding a filter for each country?

    Next, it is a anti-pattern to load lots of data into memory, just to query something else. Did you consider to either use synced records or a database view to query the final data for a given user in a single request?

Reply
  • 0
    Certified Lead Developer

    When you query a view, I suspect a timeout. Try to optimize that view.

    Did you consider to use a single filter using the "IN" operator instead of adding a filter for each country?

    Next, it is a anti-pattern to load lots of data into memory, just to query something else. Did you consider to either use synced records or a database view to query the final data for a given user in a single request?

Children