Very slow database performance

I too have a case of a relatively slow db performance, and found out that the search() method itself on data tables is not slow, but the actual use of data (i.e. when you assign the search iterator to container items). Interestingly, I found practically no difference when using some_field=q.any_of() with lots of possibilities (>20) in comparisson to a simple some_field=some_value.

Every anvil.server.call() from client to the server takes 1s on average in my app. Since I have some complex forms where I combine data from several queries, a bad approach was to have not only one but several (also more than 10) anvil.server.call() statements to load all the data. After investigation I changed my “architecture” and now I use only one call per form, where server function packs search iterators in a dictionary.

It would be nice if anvil would have some way to load only the server module which is actually used in a specific call.