所以我有一个包含 2000 万行的表 bj10dcmegablast。现在我想做一个查询
select *, max(qEnd - qStart)
from
(select qFileID,qLocus,qTranscript,qLength,sFileId,sLocus,sTranscript,
sLength,qStart,qEnd,sStart,sEnd
from bj10dcmegablast
where (qLocus, qTranscript)
in
(select distinct qLocus, qTranscript
from
(select qLocus, qTranscript, count(distinct sFileID) as counts
from bj10dcmegablast
group by qLocus, qTranscript
having counts > 6) as middle1)) as middle2
group by qLocus,sLocus;
我不知道需要多长时间。我运行了这个查询一小时。还没完。
所以我做了一些测试:
select qLocus, qTranscript, count(distinct sFileID) as counts
from bj10dcmegablast
group by qLocus, qTranscript
having counts > 6
这需要 40 秒。
select distinct qLocus, qTranscript
from
(select qLocus, qTranscript, count(distinct sFileID) as counts
from bj10dcmegablast
group by qLocus, qTranscript
having counts > 6) as middle1;
这个需要2分钟。
任何人都可以说出您认为完整查询将持续多长时间?