Skip to content

Cascading settings result in N+1

The cascading settings framework has child objects read values from parent objects. It also allows parent objects to override child object values by "locking" the value of a setting.

This behavior is looked up in real-time and is not cached, which means that it results in an N+1 whenever the value of the setting on a child object is "read"

To work around this issue we could:

  1. Actually cascade the value of the parent object to the child objects so that the value is always being read directly from the child rather than joining to the parent
  2. Improve the SQL efficiency of the define_attr_reader method in the CascadingNamespaceSettings / CascadingProjectSettings modules
  3. Cache the value in Redis