Skip to content

Cache the results of retrieveQualifiedColumns? #172

Description

@davidAtInleague

we have something like this

component extends=quick {
   function relation() { hasOne(...) }
   function applyGlobalScopes() {
      this.withFoo().withBar().withBaz();
   }
   function scopeWithFoo(qb) { addSubselect("foo", "relation.nestedRelation.property1"); }
   function scopeWithBar(qb) { addSubselect("bar", "relation.nestedRelation.property2"); }
   function scopeWithBaz(qb) { addSubselect("baz" "relation.nestedRelation.property3"); }
}

"nestedRelation" is an entity with 100 properties, which can take about 10ms to run "retrieveQualifiedColumns".

For every instantiation of the HasOne relation, it re-runs "retrieveQualifiedColumns", which scales poorly.

Can the results of retrieveQualifiedColumns be cached? I would expect yes if it only considers non-virtual, lexically declared properties (i.e. those declared like property name='foo' sqltype='varchar' ...;); I have some traces that seem to indicate this is the case, but my visibility into the inner workings is limited and maybe it does, or sometimes can, consider virtual attributes, which may make caching difficult.

If it only considers lexically declared properties, it might be nice to do this at coldbox startup time, maybe configurably. In production cases I wouldn't expect schema to change. In development, well, you'd have to reboot coldbox, which seems reasonable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions