gbv / jskos-server

Web service to access JSKOS data
https://coli-conc.gbv.de/api/
MIT License
6 stars 4 forks source link

Optimize queries to improve count performance #136

Closed stefandesu closed 3 years ago

stefandesu commented 3 years ago

The current version has an issue where an empty request to /mappings uses an aggregation pipeline (even though the query is empty) which causes the document counting to have a complexity of O(n) instead of O(1).

Instead, we should determine whether the query is empty, and in that case use estimatedDocumentCount().