我有这张桌子:
public class DataTable
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long SeqNum { get; set; }
[Key, Column(Order = 0)]
public int SourceId { get; set; }
[Key, Column(Order = 1)]
public int Epoc { get; set; }
[Key, Column(Order = 2)]
public int InternalSourceId { get; set; }
public byte[] AllElementsData { get; set; }
}
该表有数百万条记录
当我尝试获取单个值时,它的工作速度非常快,但是当我尝试获取一系列值时,它的速度非常慢
这是我的查询:
DataTable[] eeee = dbTables.DataTable.Where(c => (c.SourceId == 5 && c.Epoc == 5 && c.InternalSourceId > 0) &&
(c.SourceId == 5 && c.Epoc == 5 && c.InternalSourceId < 5)).ToArray();
我做错了什么?