Opened 2 years ago

Closed 2 years ago

#2286 closed enhancement (fixed)

Improve performance for multi-hop child->parent->child kolumns

Reported by: Nicklas Nordborg Owned by: everyone
Priority: major Milestone: BASE 3.19.5
Component: core Version:
Keywords: Cc:

Description

In #2282, new functionality made it possible to display values from a child1->parent->child2 relation in a table list. Depending on the distance between parent and child items this may require a lot of queries against the database before the final child item is reached. One big issue is that when the parent has been reached and the downwards path to the child2 item is started the queries will once again load the same items as when moving up to the parent item. If it is certain that the two child items live in different arms as seen from the parent item it would improve performance if the up-going path was ignored when going down to the second child item.

Note that it may also make sense to not do this filtering so it should be an option.

Here are two examples:

A:

  • A list with DNA extracts is displayed.
  • A column that display ->Parent(Lysate)->Child(RNA) will then display only the RNA that was extracted from the same Lysate as the corresponding DNA.
  • In this case it makes sense to enabled the performance optimization

B:

  • The same list with DNA extracts is displayed.
  • A column that display ->Parent(Patient)->Child(RNA) will then display all RNA that is related to the same patient as the DNA, including those RNA that are from different samples.
  • In this case the performance optimization can't be used.

Change History (5)

comment:1 by Nicklas Nordborg, 2 years ago

In 8087:

References #2286: Improve performance for multi-hop child->parent->child kolumns

Implemented support for keeping track of all items that are handled by a SourceItemTransformer chain. The information is stored in the TransformContext and can be used to "avoid" items when doing a second transform using the same context.

So, when doing a child->parent->child transform, during the first phase from child->parent the context will remember all items if the TransformContext.setCollecting() method has been called. During the second phase from parent->child doubling back can be avoided by calling TransformContext.setAvoiding().

comment:2 by Nicklas Nordborg, 2 years ago

In 8088:

References #2286: Improve performance for multi-hop child->parent->child kolumns

Implemented functionality for allowing/not allowing doubling back when creating a related item column that has a child->parent->child specification. The default is to not allow doubling back.

comment:3 by Nicklas Nordborg, 2 years ago

In 8089:

References #2286: Improve performance for multi-hop child->parent->child kolumns

Implemented support also when filtering on such columns. Ther was an issue was with the caching feature that only considered the set of source items. The "doubling back" prevention can now yield different results with the same set of source items, depending on the path that was used while reaching the source items. The caching issue was solved by using the filter string as part of the cache key.

comment:4 by Nicklas Nordborg, 2 years ago

In 8090:

References #2286: Improve performance for multi-hop child->parent->child kolumns

Documented the "doubling back" functionality.

comment:5 by Nicklas Nordborg, 2 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.