Skip to content

Commit c179fb5

Browse files
authored
Revise section about millions of Entities (#1927)
1 parent c122c7b commit c179fb5

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

docs/entities-intro.rst

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,21 @@ Can I have millions of Entities?
124124

125125
There are two current limitations that make millions of Entities impractical: data transfer and form performance.
126126

127-
Currently, all Entities that have not been deleted are sent to every device on every update. Depending on your data connection, this may be a limiting factor for your project. We will eventually add support for archiving Entities to address this limitation.
127+
Currently, all Entities that have not been deleted are sent to every device on every update. Depending on your data connection, this may be a limiting factor for your project. To address this, we will eventually add functionality such as archiving Entities, synchronizing only updated Entities, or assigning a subset of Entities to a user.
128128

129-
Entities are currently represented in memory for access by forms. Modern devices can easily process multiple tens of thousands of entities in this way, but your form may become slow or crash if you have more than 50,000 Entities.
129+
Starting in Collect v2024.3 and Central v2024.3, Entities are optimized so that larger numbers can be used in forms. If your choice filters and :ref:`lookup expressions <referencing-values-in-datasets>` use simple expressions with ``=``, ``and`` and ``or``, they will be performed quickly. We verify that a form with 100,000 Entities with 6 properties that are each 36 random characters long is usable on a device from 2021 with 3 GB of RAM.
130130

131-
We are actively working on addressing these performance limitations and expect significant improvements by late 2024. In the mean time, one possible workaround is to use `pulldata <https://xlsform.org/en/#how-to-pull-data-from-csv>`_ and `search() <https://xlsform.org/en/#dynamic-selects-from-pre-loaded-data>`_ instead of `instance` and `select_one_from_file`. These methods are less flexible but they will perform better.
131+
If you use function calls in choice filters or lookup expressions, the entire Entity List may need to be stored in memory. Modern devices can easily process multiple tens of thousands of entities in this way, but your form may become slow or crash if you have more than 50,000 Entities.
132+
133+
The number of properties that each Entity has and the size and uniqueness of values saved will also affect both data transfer and form performance.
134+
135+
.. seealso::
136+
:ref:`What form fields should I save to my Entities as properties? <entities-intro-form-fields>`
137+
138+
If you have a form with may Entities that feels slow, we encourage you to post about it on `the forum <https://forum.getodk.org/c/support/6>`_ so that we can recommend approaches that will make it work faster or design improvements to the system.
139+
140+
.. note::
141+
We generally do not recommend using `search() <https://xlsform.org/en/#dynamic-selects-from-pre-loaded-data>`_ instead of ``select_one_from_file`` because it does not work with offline Entities and is less flexible. Starting in Collect v2024.3 and Central v2024.3, there is limited performance benefit to ``search()``.
132142

133143
My form captures data on multiple different things, can I create multiple Entities with a single submission?
134144
------------------------------------------------------------------------------------------------------------
@@ -232,6 +242,8 @@ You can access a specific Entity's properties using a :ref:`lookup expression <r
232242
* :doc:`Community reporting tutorial <tutorial-community-reporting>`
233243
* :ref:`Build a form that uses Entities <central-entities-follow-up-forms>`
234244

245+
.. _entities-intro-form-fields:
246+
235247
What form fields should I save to my Entities as properties?
236248
------------------------------------------------------------
237249

0 commit comments

Comments
 (0)