Hi Team,
I am trying to evaluate how much time couchbase queries are taking to execute in both Python sdk 2 and 3.
In doing so, I am unable to understand the scenario listed below:
Python sdk 2.5.4
Code snippet:
print ('-----------------')
start = datetime.now()
result = []
query1_5 = "select * from `<bucket-name>` where type='<doc_type>' \
and <attr1_name>='<attr1_value>' and <attr2_name>='<attr2_value>' and <attr3_name>='<attr3_value>'"
res = cb.n1ql_query(query1_5)
for i in res:
result.append(i)
print (f"Elapsed time - {res.metrics['elapsedTime']}")
print (f"Execution time is - {res.metrics['executionTime']}")
end = datetime.now()
print (f'total time is - {(end-start).total_seconds()*1000}ms')
print ('--------------------')
Output in shell:
Elapsed time - 6.498555ms
Execution time is - 6.369113ms
total time is - 53.985ms
Why total time of ~53ms is not getting included in the metrics dict of couchbase result object. Is my understanding of execution time incorrect here?
Kindly clarify!
Thanks,
Devansh