Re: Getting maximum / minimum field value - slow query
A large start value is probably worse performing than the sort (see SOLR-1726). Once the sort field is cached, it'll be quick from then on. Put in a warming query in solrconfig for new and/or firstSearcher that does this sort and the cache will be built in advance of queries at least. Erik On Jun 13, 2012, at 16:09 , Jack Krupansky wrote: > Try the query without the sort to get the number of rows, then do a second > query using a "start" equal to the number of rows. That should get you the > last row/document. > > -- Jack Krupansky > > -Original Message- From: rafal.gwizd...@gmail.com > Sent: Wednesday, June 13, 2012 3:07 PM > To: solr-user@lucene.apache.org > Subject: Getting maximum / minimum field value - slow query > > Hi, I have an index with about 9 millions of documents. Every document has an > integer 'Id' field (it's not the SOLR document identifier) and I want to get > the maximum value of that field. > Therefore I'm doing a search with the following parameters > query=*.*, sort=Id desc, rows=1 > > > > 0 > 2672 > > *:* > 1 > Id desc > > > > > CRQIncident#45165891 > > > > > The problem is that it takes quite a long time to get the response (2-10 > seconds). Why is it so slow - isn't it a simple index lookup? > > Best regards > RG > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/Getting-maximum-minimum-field-value-slow-query-tp3989467.html > Sent from the Solr - User mailing list archive at Nabble.com.
Re: Getting maximum / minimum field value - slow query
Try the query without the sort to get the number of rows, then do a second query using a "start" equal to the number of rows. That should get you the last row/document. -- Jack Krupansky -Original Message- From: rafal.gwizd...@gmail.com Sent: Wednesday, June 13, 2012 3:07 PM To: solr-user@lucene.apache.org Subject: Getting maximum / minimum field value - slow query Hi, I have an index with about 9 millions of documents. Every document has an integer 'Id' field (it's not the SOLR document identifier) and I want to get the maximum value of that field. Therefore I'm doing a search with the following parameters query=*.*, sort=Id desc, rows=1 0 2672 *:* 1 Id desc CRQIncident#45165891 The problem is that it takes quite a long time to get the response (2-10 seconds). Why is it so slow - isn't it a simple index lookup? Best regards RG -- View this message in context: http://lucene.472066.n3.nabble.com/Getting-maximum-minimum-field-value-slow-query-tp3989467.html Sent from the Solr - User mailing list archive at Nabble.com.
Re: Getting maximum / minimum field value - slow query
What is more, I tried to get the maximum value using stats query This time the response time was about 30 seconds and server ate 1.5 Gb of memory when calculating the response. But there were no statistics in response: 0 27578 *.* true Id 0 What's wrong here? -- View this message in context: http://lucene.472066.n3.nabble.com/Getting-maximum-minimum-field-value-slow-query-tp3989467p3989468.html Sent from the Solr - User mailing list archive at Nabble.com.