1. I have corrected the e-mail settings so that outgoing e-mails from these forums should be sent now. If you tried to Register or Reset your Password, please try again!
    Dismiss Notice

Error when using c:explain

Discussion in 'Census: General Discussion' started by DanKinney, Feb 13, 2012.

  1. DanKinney

    DanKinney Guest

    There is a neat Query Command called c:explain that will let you know how your query uses available indexes.  It is very useful to tracking down slow queries.

    However, there is a known bug in the output when you use the xml format.

    Some of the data returned from this is not easily displayed in XML - it is natively in JSON format.  If you get an error when you add the c:explain=1 to your query, change it (at least temporarily) to use json (or jml if you want to be able to easily read it).  

    -dan

     
  2. DanKinney

    DanKinney Guest

    We've just fixed this error, so feel free to use c:explain=1 with the XML format again.

    Looking at the top-level element (in XML to prove that it works)...

    <explanation collection="character" cursor="BtreeCursor name.first_lower_1 multi" indexOnly="False" isMultiKey="False" millis="155" n="8" nChunkSkips="0" nYields="0" nscanned="7194" nscannedObjects="8">

    What you are really looking for in here is the nscanned attribute.  If this is really large, especially in relation to the n attribute (the number of objects returned), the query is doing a lot of work on the search.

    -dan

     

Share This Page