Description
https://docs.couchbase.com/server/current/manage/monitor/monitoring-n1ql-query.html#completed-limit notes:
"The completed-limit field sets the number of most recent requests to be tracked in ..."
However completed requests operates using a generic cache which doesn't guarantee a FIFO order; it does approximate this only.
https://github.com/couchbase/query/blob/9516fd845fb5254230bfd028a42536473491d3a7/util/cache.go#L159
Furthermore, management is based on when requests are logged - i.e. at completion time - not when they started.
It may therefore be worth adding a note to this paragraph along the lines of:
Note: For performance reasons completed_requests management only approximates the order of requests when evicting the oldest entries to satisfy this limit.
Eviction is based on when requests complete and are logged, not when they started, so requests with a later start time (requestTime) but completed sooner may be evicted first.