Several of our APIs accept a filter as part of the request, which tells our databases which data to return. We don't have restrictions on the filters that we accept, so our customers can create quite complex filters that include logical operators and custom data.
Before going live with your app, we like to review your filters for two reasons.
- Complex filters can often be simplified, improving performance
- We may need to apply indexes to our databases so that requests are performant and don't time out in the worst case.
Which APIs?
- QueryChannels/ChannelList - the API returns a list of channels.
- QueryUsers - optional API that some customers choose to use. Generally, if fetching lists of users, we recommend using your own user store.
- Search
- QueryMembers
How to Structure Queries
For scale, the more simple the filter, the more performant it will be. Try to structure your filter in a way that takes a large number of channels and filters them down to a much smaller set. Always avoid sending an empty filter, it will timeout eventually
Avoid Loops and Client-Side Filters
Always avoid trying to run the queries in loops and paginating lists to completion before performing filtering client-side. This will almost never scale well. Talk to support if you think you need to do this, there is probably an alternative.
Comments
0 comments
Please sign in to leave a comment.