mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-18 14:58:47 +00:00
AutoTune update - rename and profiling against original query
This commit is contained in:
1 parent
116cc3a3fe
commit
71dd0e5728
15 files changed
+322
-268
No files matched your search
@@ -81,7 +81,7 @@ public class OrmQueryDetail implements Serializable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if equal in terms of autofetch (select and joins).
|
||||
* Return true if equal in terms of autoTune (select and fetch).
|
||||
*/
|
||||
public boolean isAutoTuneEqual(OrmQueryDetail otherDetail) {
|
||||
|
||||
@@ -91,6 +91,9 @@ public class OrmQueryDetail implements Serializable {
|
||||
if (fetchPaths == null) {
|
||||
return otherDetail.fetchPaths == null;
|
||||
}
|
||||
if (fetchPaths.size() != otherDetail.fetchPaths.size()) {
|
||||
return false;
|
||||
}
|
||||
Set<Map.Entry<String, OrmQueryProperties>> entries = fetchPaths.entrySet();
|
||||
for (Map.Entry<String, OrmQueryProperties> entry : entries) {
|
||||
OrmQueryProperties chunk = otherDetail.getChunk(entry.getKey(), false);
|
||||
@@ -100,7 +103,6 @@ public class OrmQueryDetail implements Serializable {
|
||||
}
|
||||
|
||||
return true;
|
||||
//return autofetchPlanHash() == otherDetail.autofetchPlanHash();
|
||||
}
|
||||
|
||||
private boolean isSame(OrmQueryProperties p1, OrmQueryProperties p2) {
|
||||
@@ -110,22 +112,6 @@ public class OrmQueryDetail implements Serializable {
|
||||
return p1.isSame(p2);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Calculate the hash for the query plan.
|
||||
// */
|
||||
// private int autofetchPlanHash() {
|
||||
//
|
||||
// int hc = (baseProps == null ? 1 : baseProps.autofetchPlanHash());
|
||||
//
|
||||
// if (fetchPaths != null) {
|
||||
// for (OrmQueryProperties p : fetchPaths.values()) {
|
||||
// hc = hc * 31 + p.autofetchPlanHash();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return hc;
|
||||
// }
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (baseProps != null) {
|
||||
@@ -236,7 +222,7 @@ public class OrmQueryDetail implements Serializable {
|
||||
boolean tuned = false;
|
||||
|
||||
OrmQueryProperties tunedRoot = tunedDetail.getChunk(null, false);
|
||||
if (tunedRoot != null && tunedRoot.hasProperties()) {
|
||||
if (tunedRoot != null) {
|
||||
tuned = true;
|
||||
baseProps.setTunedProperties(tunedRoot);
|
||||
|
||||
|
||||
@@ -215,9 +215,13 @@ public class OrmQueryProperties implements Serializable {
|
||||
* Set the properties from a matching autofetch tuned properties.
|
||||
*/
|
||||
public void setTunedProperties(OrmQueryProperties tunedProperties) {
|
||||
this.properties = tunedProperties.properties;
|
||||
this.trimmedProperties = tunedProperties.trimmedProperties;
|
||||
this.included = tunedProperties.included;
|
||||
if (tunedProperties.hasProperties()) {
|
||||
this.properties = tunedProperties.properties;
|
||||
this.trimmedProperties = tunedProperties.trimmedProperties;
|
||||
this.included = tunedProperties.included;
|
||||
this.queryFetchBatch = Math.max(queryFetchBatch, tunedProperties.queryFetchBatch);
|
||||
this.lazyFetchBatch = Math.max(lazyFetchBatch, tunedProperties.lazyFetchBatch);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -262,6 +266,7 @@ public class OrmQueryProperties implements Serializable {
|
||||
copy.parentPath = parentPath;
|
||||
copy.path = path;
|
||||
copy.properties = properties;
|
||||
copy.trimmedProperties = trimmedProperties;
|
||||
copy.cache = cache;
|
||||
copy.readOnly = readOnly;
|
||||
copy.queryFetchAll = queryFetchAll;
|
||||
|
||||
Reference in new issue
Block a user