Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor prepopulation #8395

Closed
wants to merge 4 commits into from
Closed

Refactor prepopulation #8395

wants to merge 4 commits into from

Commits on Sep 21, 2018

  1. NEW: Add DB::replace_parameter()

    This helper is necessary when you want to replace a parameter with a
    non-literal such as a column name. This arises when you are
    transforming queries such as we do in the prepopulation query for
    Hierarchy::numChildren()
    Sam Minnee committed Sep 21, 2018
    Configuration menu
    Copy the full SHA
    1d81ecb View commit details
    Browse the repository at this point in the history
  2. NEW: Add Hierarchy::prepopulate_numchildren_cache()

    API: Hierarchy::stageChildren() customisations must be applied to the base class and not include record-specific behaviour.
    
    Adds the ability to prepopulate the cache for Hierarchy::numChildren()
    in a batch.
    
    Note that this optimisation means that stageChildren() is not called on
    each record in order to calculate numChildren(). This means that the
    structure of the stageChildren() query must be the same for all records
    and the behaviour cannot be customised only for a subclass of the base
    data class. For example, apply your customisations to SiteTree and not
    a subclass.
    
    This is an useful part of optimising the query count on tree generation.
    See #8379
    Sam Minnee committed Sep 21, 2018
    Configuration menu
    Copy the full SHA
    ac43376 View commit details
    Browse the repository at this point in the history
  3. Add a _complete flag prepopulate_numchildren_cache

    This will avoid trying to count the children of childless object.
    maxime-rainville authored and Sam Minnee committed Sep 21, 2018
    Configuration menu
    Copy the full SHA
    574918c View commit details
    Browse the repository at this point in the history
  4. NEW: Add Hierarchy::prepopulateTreeDataCache()

    This provides a more extensible way of preopulating caches for optimised
    tree generation.
    
    Fixes #8391
    Sam Minnee committed Sep 21, 2018
    Configuration menu
    Copy the full SHA
    eb4d73c View commit details
    Browse the repository at this point in the history