EnterpriseDB / mongo_fdw

PostgreSQL foreign data wrapper for MongoDB
GNU Lesser General Public License v3.0
326 stars 70 forks source link

Mongo views and ForeignTableDocumentCount #124

Open arch89 opened 5 years ago

arch89 commented 5 years ago

mongo_fdw use count() on collection to estimate execution's plan, this is not acceptable for mongo views. View is just alias for aggregation pipeline, so every count call on it literally drawn all results every time, even if you pass filter query. Even more, seems, that mongo_fdw calls count() on collection twice before find.