that depends on how often does that keyword occur if you have 2 million records, 500k of which contain some keyword and you only need first 10 - best way would be to create an index on the field that is used for sorting and then filter results of index-scan.
if only few records contain keyword then using ftindex-scan and then order by is the best way to do it. there are several ways to optimize this - remove ddo by using unordered; move fields that you need to sort by closer to record, so that xpath could be evaluated faster; removing cast by using representation that cat be sorted lexicographically could also help. btw, sort performance may increase in the next release, but I don't know how much. On Tue, Mar 22, 2011 at 7:31 PM, giocondo sticca <[email protected]> wrote: > > Hi, > > all I really need is to find documents that contain specific keywords and > order it by some fields like date, title, section #, etc.. in ascending and > descending mode. > > How I can optimize this kind of query ? > > Thanks. > > On Tue, Mar 22, 2011 at 2:48 PM, Roman Pastukhov <[email protected]> wrote: >> >> Hi, >> >> No it's impossible to automatically sort index-scan results by >> something other than key value or ftindex-scan results by something >> other than PPSXptr order. >> >> Note that in your query PPDDO (which is actually sorting by document >> order) takes 3 seconds, and since it's not really needed, it should be >> avoided (by using declare ordering unordered and sometimes adding >> extra for loops to get rid of PPSXptr which is also a sort). >> >> Also note that parsing dates takes 4 seconds. One of obvious ways of >> improving performance of such queries is to store data sorted by date, >> thus document order will be what you need, and PPDDO will be >> sufficient. This will eliminate order by and date parsing, but you'll >> need to modify updates so that they would maintain data ordered by >> date. >> > ------------------------------------------------------------------------------ Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar _______________________________________________ Sedna-discussion mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sedna-discussion
