You're probably running into memory issues, perhaps swapping. Or you have commits (hard with openSearcher=true or soft) happening very frequently.
Lucene's sort algorithm reads all the values into memory even for a single-field document result. So if this is getting reloaded for each search, that's one problem. If you're measuring the first response and it's 30 seconds but subsequent searches with the same sort (but different result sets) are fast then you're seeing the ids being read into memory the first time and can fix this with autowarming. If you're seeing _all_ queries sorting on ID 30 seconds you need to think about your setup. Best Erick On Sun, Jul 7, 2013 at 7:51 AM, kowish.adamosh <kowish.adam...@gmail.com> wrote: > Jack, > > Do you think DocValues with unique field make sense? From what I read, it > will only double index size for that field. It will give just a different > numbers of field. I have really big problem with sorting by unique field. > Without sorting, event in 40-50 GB index, almost every query is quite fast > but with sorting it takes even a minutes (using string or long as a type)! > Do you guys have solution of that? > > I am wondering why sorting works before actual query. Look at example: > q=id:3000 -> 10ms (only one result) > q=id:3000&sort=someUniqueField desc -> 30 seconds (only one result). > > In theory sorting one result shouldn't take time. > > Thanks, > Kowish > > > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/Sorting-tp4075747p4076033.html > Sent from the Solr - User mailing list archive at Nabble.com.