hi friends,i have a query as followsselect distinct -- top 15 INDOCNO,CHAR_FIELD2_AR,CHAR_FIELD3,convert(nvarchar,FORWARD_DATE,103) as FORWARD_DATE,convert(nvarchar,close_date,103) as close_date,REVISION_NO,convert(nvarchar,ISHAAR_DATE,103) as ISHAAR_DATE,CHAR_FIELD1,SUBJECT,m.docno as docno,m.confid_id as confid,COALESCE(DC2.CHILD_DOCNO,DC1.CHILD_DOCNO) AS ISLINKED,att.docno as attach,f.docname from TECHNICAL_MAIN m left outer join oaefile_doclinks dc1 on m.docno=dc1.parent_docno LEFT OUTER JOIN OAEFILE_DOCLINKS DC2 ON m.DOCNO=DC2.CHILD_DOCNO left outer join TECHNICAL_ATTACH att on m.docno=att.docno left outer join dmsdocinfo f on att.attach_docno=f.docid where m.indocno between '104889'and '104903' Order by m.docno desc
the query run time is about 9 seconds when i select top 15but when i select between '104889'and '104903' query time more than 20 secs, although its giving the same result.how to optimise ? what indexings you propose ?the main table is technical_main having 130000 recordsothers have more records // docno and indocno are integerswhat about millions or records what will happen then!!