Description
The Postgres provider currently performs a full .count() on every request to populate numberMatched, which significantly slows down queries on large tables. This makes API responses much slower than necessary, especially when querying large datasets for a small subset of the features.
Steps to Reproduce
- Set up pygeoapi with a large Postgres table as a data source.
- Make a request to an endpoint that queries the table.
- Observe that the response time is impacted by the .count() operation.
Expected behavior
Queries should return results faster by avoiding expensive .count() operations on large tables.
Potential workarounds are:
Screenshots/Tracebacks
If applicable, add screenshots to help explain your problem.
Environment
- OS: Mac
- Python version: 3.10
- pygeoapi version: 0.20.dev0
Additional context
Similar constraints exist in other providers, with some only doing a count of features when resulttype=hits
Description
The Postgres provider currently performs a full .count() on every request to populate
numberMatched, which significantly slows down queries on large tables. This makes API responses much slower than necessary, especially when querying large datasets for a small subset of the features.Steps to Reproduce
Expected behavior
Queries should return results faster by avoiding expensive .count() operations on large tables.
Potential workarounds are:
Screenshots/Tracebacks
If applicable, add screenshots to help explain your problem.
Environment
Additional context
Similar constraints exist in other providers, with some only doing a count of features when
resulttype=hits