fdb-document-layer icon indicating copy to clipboard operation
fdb-document-layer copied to clipboard

explain() response should have user readable keys

Open apkar opened this issue 6 years ago • 2 comments

explain() return information about query plan. Whether an index is being used or not, and how the scan is being used. Right now, it looks something like this

In [13]: db.correctness475041058659.find({'A': { 'A': None, 'C': {}}}).explain()
Out[13]:
{u'explanation': {u'source_plan': {u'projection': u'{}',
   u'source_plan': {u'bounds': {u'begin': u'3\\x10\\x00\\xff\\x00\\xff\\x00\\xff\\x0aA\\x00\\xff\\x03C\\x00\\xff\\x05\\x00\\xff\\x00\\xff\\x00\\xff\\x00\\xff\\x00\\xff\\x00',
     u'end': u'3\\x10\\x00\\xff\\x00\\xff\\x00\\xff\\x0aA\\x00\\xff\\x03C\\x00\\xff\\x05\\x00\\xff\\x00\\xff\\x00\\xff\\x00\\xff\\x00\\xff\\x00'},
    u'index name': u'A_1_B_1_B_1',
    u'type': u'index scan'},
   u'type': u'projection'},
  u'type': u'non-isolated'}}

Although, this gives an overview of what’s going on. It will be much more useful if the keys are user readable, instead of FDB keys.

apkar avatar Nov 30 '18 07:11 apkar

@apkar Please assign this ticket to me. We think we could address this using the existing decode_key_part function

senthil-db-expert avatar Aug 22 '19 01:08 senthil-db-expert

explain() doesn't have to include the entire FDB key. As the FDB key contains the prefix pointing to collection or index as well. Make sure to remove the prefix.

apkar avatar Aug 22 '19 02:08 apkar