0

Hello,
Our SolidCP has becore really slow. There is a query:
SELECT
Q.QuotaID,
Q.GroupID,
Q.QuotaName,
Q.QuotaDescription,
Q.QuotaTypeID,
QuotaValue = CASE WHEN Q.PerOrganization = 1 AND dbo.GetPackageAllocatedQuota(@PackageID, Q.QuotaID) <> -1 THEN
dbo.GetPackageAllocatedQuota(@PackageID, Q.QuotaID) * @OrgsCount
ELSE
dbo.GetPackageAllocatedQuota(@PackageID, Q.QuotaID)
END,
QuotaValuePerOrganization = dbo.GetPackageAllocatedQuota(@PackageID, Q.QuotaID),
dbo.GetPackageAllocatedQuota(@ParentPackageID, Q.QuotaID) AS ParentQuotaValue,
ISNULL(dbo.CalculateQuotaUsage(@PackageID, Q.QuotaID), 0) AS QuotaUsedValue,
Q.PerOrganization
FROM Quotas AS Q
WHERE Q.HideQuota IS NULL OR Q.HideQuota = 0
ORDER BY Q.QuotaOrde
that takes around 7 seconds to be executed and since it used quote often it’s getting really slow. The database server is using SSDs and we have run the profiler but it doesn’t give us any more suggestions for optimization. I suspect dbo.GetPackageAllocatedQuota is causing the slowness, but I’m not sure hot to optimize it.
Thanks,
Chris

Answered question