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

Cache the results of retrieveQualifiedColumns? #172

Open
davidAtInleague opened this issue Feb 24, 2022 · 0 comments
Open

Cache the results of retrieveQualifiedColumns? #172

davidAtInleague opened this issue Feb 24, 2022 · 0 comments

Comments

@davidAtInleague
Copy link
Contributor

davidAtInleague commented Feb 24, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant