Suresh, Two things I noticed. 1) If your intent is to only match records where there's something, anything, in abstract_or_primary_product_id, you should use fieldname:[* TO *] but that will exclude records where that field is empty/missing. If you want to match records even if that field is empty/missing, then you should remove that clause entirely 2) Because all your clauses are more like filters and are ANDed together, you'll likely get better performance by putting them _each_ in an fq E.g. fq=product_identifier_type:DOTCOM_OFFER fq=abstract_or_primary_product_id:[* TO *] fq=gtin:<numericValue> fq=product_class_type:BUNDLE fq=hasProduct:N
On Thu, Aug 31, 2017 at 1:35 PM suresh pendap <sureshfors...@gmail.com> wrote: > Hello everybody, > > We are seeing that the below query is running very slow and taking almost 4 > seconds to finish > > > [<shard7_replica1>] webapp=/solr path=/select > > params={df=_text_&distrib=false&fl=id&shards.purpose=4&start=0&fsv=true&sort=modified_dtm+desc&shard.url=http:// > <host1>:8983/solr/flat_product_index_shard7_replica1/%7Chttp://<host2>:8983/solr/flat_product_index_shard7_replica2/%7Chttp://<host3>:8983/solr/flat_product_index_shard7_replica0/&rows=11&version=2&q=product_identifier_type:DOTCOM_OFFER+AND+abstract_or_primary_product_id:*+AND+(gtin:<numericValue>)+AND+-product_class_type:BUNDLE+AND+-hasProduct:N&NOW=1504196301534&isShard=true&timeAllowed=25000&wt=javabin} > hits=0 status=0 QTime=3663 > > > It seems like the abstract_or_primary_product_id:* clause is contributing > to the overall response time. It seems that the > abstract_or_primary_product_id:* . clause is not adding any value in the > query criteria and can be safely removed. Is my understanding correct? > > I would like to know if the order of the clauses in the AND query would > affect the response time of the query? > > For e.g . f1: 3 AND f2:10 AND f3:* vs . f3:* AND f1:3 AND f2:10 > > Doesn't Lucene/Solr pick up the optimal query execution plan? > > Is there anyway to look at the query execution plan generated by Lucene? > > Regards > Suresh >