mirror of https://github.com/apache/cloudstack.git
server: fix full table scanning for listHosts API
The type parameter isn't keyword, but a simple listHosts API call with type=Routing, runs SELECT COUNT(*) FROM host WHERE host.type LIKE '%Routing' AND host.removed IS NULL; ... which causes an unnecessary full table scan. Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
076a712fbe
commit
35462dc96d
|
|
@ -2146,7 +2146,7 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q
|
|||
// ids
|
||||
hostSearchBuilder.and("id", hostSearchBuilder.entity().getId(), SearchCriteria.Op.EQ);
|
||||
hostSearchBuilder.and("name", hostSearchBuilder.entity().getName(), SearchCriteria.Op.EQ);
|
||||
hostSearchBuilder.and("type", hostSearchBuilder.entity().getType(), SearchCriteria.Op.LIKE);
|
||||
hostSearchBuilder.and("type", hostSearchBuilder.entity().getType(), SearchCriteria.Op.EQ);
|
||||
hostSearchBuilder.and("status", hostSearchBuilder.entity().getStatus(), SearchCriteria.Op.EQ);
|
||||
hostSearchBuilder.and("dataCenterId", hostSearchBuilder.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
||||
hostSearchBuilder.and("podId", hostSearchBuilder.entity().getPodId(), SearchCriteria.Op.EQ);
|
||||
|
|
@ -2198,7 +2198,7 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q
|
|||
sc.setParameters("name", name);
|
||||
}
|
||||
if (type != null) {
|
||||
sc.setParameters("type", "%" + type);
|
||||
sc.setParameters("type", type);
|
||||
}
|
||||
if (state != null) {
|
||||
sc.setParameters("status", state);
|
||||
|
|
|
|||
Loading…
Reference in New Issue