Is assigning thing as value to another thing more efficient than doing search for?

I have a question in terms of data fetching and efficiency of data architecture:

Suppose a thing A’s child field is mapped to thing B, and I’m looking for the thing A associated to B:

  • I could simply rely on a good ol’ Do a search for A where A’s child is B each time I need it.
  • I could also assign A to B’s parent field, so that when I need A I could simply call A’s parent relationship.

Something tells be the second option is more efficient.

Now assuming there is a one-to-many relationship: does assigning all children as a value-as-a-list also speed up the search for the children things?

It appears to be more efficient when relying on the interface, but who knows what’s going on behind the scene? Maybe it’s all the same.

Any insights?

1 Like

I believe anytime you can “not” do a search for a thing and instead reference it as it is already on the page ( and I believe therefore “client side” ) it will speed up the retrieval of information…the less database searches the better in my experience

1 Like

In fact I am using a hidden repeating group ( it is stored in a popup ) so that when the page loads, I do a search of all products and it lives in that repeating group. I then have another repeating group that the filters run through using the R.G in the popup as it’s datasource and it seems to be faster than searching after user filters.

1 Like

Oh that’s nice! I’ll try that trick.

Also remember when you are nesting groups inside of each other to reference the parent element’s thing…so have a group on page that might take up most of the page except the header position…make that group the “thing” you want the page to be. Then every group inside of that “main group” reference the parent element.

Make sure your database is set up to be relational.

For example

Data type = business listing ( datafields like “name - text” “address - geo address” “products - products”

Data type = products ( datafields like “name - text” “id - text” “image - image”

You can set up your group to show “parent groups business listings’ products” so you can easily retrieve all the products carried by that business without needing to do a full search of your database for all products; nor do you need to do a database search for all business listings.

Database structure is a key component to get fast retrieval of data on page.

I’ve even gone so far as to have a data type of “state” with data fields of “city - city” “buisness listings - business listings”

so that a user will be able to retrieve all the business listings in their state instead of needing to search all business listings from all states…I use the IP address information to find which state they are in

1 Like

Hey this is a really good tip! I’ve tried it and my workflow log timestamps went from 1 min 30 seconds to about 2 seconds!

2 Likes

Hi,

I have to get back to this and state that the solution isn’t working properly. I’ve compared the workflow in A-B testing, one using a list-value on the page element (so the Game’s Deck is a list of cards {card1, … card108}), the other feeding this list to a repeating group.

The workflow is filtering 36 cards of each 3 types from the 108 card set, sorts them randomly and tags 22 as “excluded”.

A. Using the list-value on the page: the workflow consistently runs through the list and marks 22 cards of each 3 type correctly.

B. Using the hidden repeating group: the workflow marks 21 cards of the first type, 20 of the second type and none of the third type. I can’t even understand why it would not fully process the workflow and can only assume the workflows are conflicting while using the same RG element. But then why would they stop before completing 22 cards? :thinking:

So for now I’m using A even if it takes more time.

it is not the same RG element…there is one in a popup RG1 and another on page RG2…RG2 just uses RG1 as its datasource so all workflows should affect RG1

Yeah that’s what I did.

I created a pop up with an RG that holds the 108 card items for storage. Then I run the workflow using these. But the workflow seems not to be executed properly.