sql - Optimize the SQLite select statement to run a lot faster -
this query want optimize, seems take 30 seconds or run on database around 1.7gb 1.5million rows in peptargetentity , targetmatchentity , thousands in customer table , searchentity table. expect such simple statement take milliseconds complete.
there indexes on :
- customer(searchid)
- peptargetentity(customerid)
- targetmatchentity(customerid)
if has ideas appreciated, in advance.
select customerid, rank, pepid, targetid, falsepositive (select t.customerid, t.rank, t.id pepid, null targetid, t.falsepositive, c.surname, c.firstname peptargetentity t inner join customer c on t.customerid= c.id c.searchid = 3265 or 3270 = 0 union select t.customerid, t.rank, null pepid, t.id targetid, t.falsepositive, c.surname, c.firstname targetmatchentity t inner join customer c on t.customerid= c.id c.searchid = 3265 or 3270 = 0) order surname asc,firstname asc,rank desc limit 50 offset 0
Comments
Post a Comment