You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Introduce an environment variable to control whether the .count() is always run.
Implement an upper limit on .count() queries, with a fallback mechanism such as TABLESAMPLE or estimated counts from Postgres' pg_stat tables.
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
The text was updated successfully, but these errors were encountered: