我在DB的联系人表中有大约100万条记录,现在我只需要得到30条。如何提高下列查询的效率:
GetContacts方法
private IQueryable<Contact> GetContacts()
{
return this.Query().Where(c => c.ActiveEmployer== true); // here ' this ' is the current service context
}
Gettin联系人
var contactlist = GetContacts(); // thi
我有表,Table_A和Table_B,分别有0.2和211万行。我需要将Table_A.Score中的字段设置为1,只要找到匹配的A1=B1 and A2=B2 and A3=B3 and A4=B4。
我使用的是查询update Table_A, Table_B set score=1 where A1=B1 and A2=B2 and A3=B3 and A4=B4;
然而,根据我的理解,这个查询花费的时间太长了(3天)。我也可以想象;因为对于Table_A行的每一次更新(其中的20万次),MySQL必须检查每一行Table_B (211万行)的4个组合。
然而,我想知