Revert "Improved performance of Count Hql queries" (#7563)

This commit is contained in:
Chris Payne
2017-02-16 21:55:47 +01:00
committed by Sébastien Ros
parent abe040174d
commit 6f39308741

View File

@@ -208,6 +208,7 @@ namespace Orchard.ContentManagement {
public int Count() { public int Count() {
ApplyHqlVersionOptionsRestrictions(_versionOptions); ApplyHqlVersionOptionsRestrictions(_versionOptions);
var hql = ToHql(true); var hql = ToHql(true);
hql = "select count(Id) from Orchard.ContentManagement.Records.ContentItemVersionRecord where Id in ( " + hql + " )";
return Convert.ToInt32(_session.CreateQuery(hql) return Convert.ToInt32(_session.CreateQuery(hql)
.SetCacheable(true) .SetCacheable(true)
.UniqueResult()) .UniqueResult())
@@ -218,7 +219,7 @@ namespace Orchard.ContentManagement {
var sb = new StringBuilder(); var sb = new StringBuilder();
if (count) { if (count) {
sb.Append("select count(distinct civ.Id)").AppendLine(); sb.Append("select distinct civ.Id as Id").AppendLine();
} }
else { else {
sb.Append("select distinct civ.Id as Id"); sb.Append("select distinct civ.Id as Id");