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?

  • Hi Stefan,

    country field is of text type and there are multiple countries in each field separated by ";" . so i'm using "includes" operator here.

    To use synced records , these tables were used in multiple places across the application and updating the data through multiple sources. so we are not considering record centric approach.

Reply Children