I want to add some computed values to prominent action buttons, that are shown only on detail views. Hopefully they are executed on demand - but who knows - if they are executed on sync its a bad decision. Here is an example of such an display name expression on a button to a filtered view:
That’s why ask this question.
So you say that these expressions are computed on render frame, in FPS manner like 60 times per second or at least on scroll screen?
FYI: in case you don’t know already, nesting a SELECT() inside another SELECT() is pretty much the worst thing you can do for performance. It’s literally brute forcing the answer.
References to the rescue!
Add some reference connections between your tables (they might actually already be there) and you can accomplish the count() much more efficiently.
If your Report is connected to the Client,
and your Contracts are connected to Client,
then on Client you’ll have two [Related whatever] columns, one for each.
[Related Table_Contract] is the field you’d want to count (if I’m reading your formula correctly)
You can use dereferences to get there from Reports
[Report_Client_Link].[Related Table_Contract]
This will increase the efficiency of the computation to a trivial thing, where you don’t really need to consider it anymore.
Because in the related columns the subselect is already done, so no need to do it twice.
On the other hand, adding the grand parent ID as reference may blew up the sync process. Imagine 1000 clients with 10 contracts with 100 reports creates 1000 “Related Table_Reports” reference IDs in each client row. What makes 1.000.000 stored reference ids in the client table or about 20MB space only for packedUUID’s - if I’m right.