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.
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.