在我们的应用程序中,我们有非常大的数据。我们需要为各种条件做聚合和计算(基于用户在UI中选择的内容)。
1)由于数据非常大,是否建议执行所有
aggregations(business logic) in database(procedures) ?or 2)Will there be a major impact if done in Business Layer after getting data from DB? As all the data will be converted to objects and then aggregation is done.
我有一个查询,它搜索一个包含大约1百万条折扣记录的大表,并且这个表有一个索引问题。
SELECT TOP 1 D.Discount
FROM Discount D
WHERE (D.ProductGroupId = @ProductGroupId OR D.ProductId = @ProductId)
AND (D.CampaignId IS NULL AND (D.CustomerGroupId = @CustomerGroupId OR D.CustomerId = @CustomerId OR (D.CustomerId IS NULL AND D.CustomerGroupId
我需要在一个有大约50.000条记录的NSDictionary的大NSMutableArray中搜索。我尝试这样做:
for (NSDictionary *aProduct in self.arrProduct) {
if ([[aProduct objectForKey:@"Name"]rangeOfString:@"search string" options:NSCaseInsensitiveSearch].location != NSNotFound) {
//got it
}
}
但是对于50.000的对象,这个函数的性
我正在实现一个报告,该报告显示了对相当大的数据集的分析。这个过程包括连接和过滤4个数据库表,这些表本身平均有大约一百万条记录。整个处理和页面渲染大约需要两分钟。通过优化查询和对数据库应用索引,我将这一时间缩短到了1分35秒左右。
考虑到我们不能进一步优化查询,有什么可能的解决方案来提高Ruby on Rails中通常使用的处理速度。