Search around linked object SET to reduce query load

Hi all

Please correct my if my understanding of ontology - search around mechanics is wrong, but wouldn’t it make sense to allow us builders in workshop to search around a specific object set instead of always the full linked object type?

Imagine the case we have two object types Account (~1M) → 1:many Sales Transaction (more then 100M goes back many many years). For the purpose of this application I am only interested in the 1-3 year sales (this might change based on users need).

Currently I get the object set as follow:

  • in workshop we start with the object set of selected_account (through some list, table, whatever)
  • I create a new object set to get all selected_account → linked sales
  • filter selected_account.linked_sales down to last X years

This is repeated every time the account selection changes based on users click.
So to my understanding this query will always load the full history of sales transactions and then filter down. I am not the expert but that sounds to me like a heavy/hungry query - no?

Within the object set variable definition, I would love the option to specify a specific object set that is searched around. Of course the link type has to be existing. To my thinking, this way I could create one time the initial object set “last_X_year_sales” and only query around this.

If this is not how ontology - search around works - I am happy to be enlightened :slight_smile:

Fortunately, that’s not how this works! In your example, whenever you want to perform an operation against the filtered object set (such as an aggregation, or loading a possibly sorted sample of records to render in a table), the Ontology query backend will construct a query against the index that looks like “find all transactions with account_id = X and transaction_date >= Y.” The thing to bear in mind is that an Object Set is not an array of objects - it’s much more analogous to a (non-materialized) View in a database. You can chain object sets together, and ultimately everything will be squashed together into a single query. There are some query patterns that can lead to poor performance (such as starting a search around from an object set with high cardinality), but your particular example should be fine.

1 Like

Mighty fistbump @sandpiper :right_facing_fist::left_facing_fist: - I was hoping my understanding was just wrong :slight_smile: