In May 2022, Anvil announced a beta release of Accelerated Tables. This is a new back-end architecture for Data Tables, bringing increased speed, scalability and flexibility. The Data Tables API does not change, but as this is a major change we are rolling this out slowly. Accelerated Tables is currently an opt-in beta program.
In order to enable Accelerated Tables for your app, open Settings, then choose Data Tables, then check the Accelerated Tables option. You do not need to change your app’s code.
The switch to enable Accelerated Tables is stored as a configuration option in your app’s source code. This means that if you have published a version of your app, you can safely experiment with the development version of your application without affecting production users.
Data written using Accelerated Tables can be read by the original Data Tables implementation, and vice versa, so it is safe to switch this option on and off.
Accelerated Tables improves speed for most access to your Data Tables. It also gives you extra benefits and control over:
Loading linked rows is significantly faster when using Accelerated Tables, particularly “Link to Multiple” rows. If you have previously avoided data architectures with these links, now might be the time to try them again.
Explicit cache control
With Accelerated Tables, you can control which columns are loaded from a table search, using the new
fetch_only search modifier.
For example, if you are querying the
users table, but only need the values of the
"enabled" columns, you can write:
from anvil.tables import query as q rows = app_tables.users.search(q.fetch_only("email", "enabled"))
This will speed up the query, by only fetching the data you need. It is possible to access other columns in rows returned from this search, but it requires a round-trip to fetch that data from the database.
You can also control what data is fetched from linked rows, by using nested
fetch_only specifications. For example, if your
users table had a link column called
group, and you only want the
"name" column from those columns, you can write:
rows = app_tables.users.search(q.fetch_only("email", group=fetch_only("name")))
All code that works with Data Tables should work with Accelerated Tables, please post in the Anvil forum with a description of the issue.