EnterpriseDB / mongo_fdw

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

Why so many find and getMore oprations in mongo after count command? #74

Closed lifubang closed 2 years ago

lifubang commented 7 years ago

Why so many find and getMore oprations in mongo after count command? "solution" is a mongo foreign table in pg, when I ran a sql in pg: SELECT COUNT(*) FROM solution; After retuned the result, it passed 4 seconds. Why? The result is 141586. But if I run the count command in mongo: db.solution.count(), It only uses 300ms.

The mongo log display after the count command, there are a find command and lots of getMore commands. I think when I run a count sql in pg, It scans all the documents in mongo. Why? and how to fix it?

gabbasb commented 7 years ago

@lifubang the current MongoDB FDW does not implement aggregate push down. It therefore selects all documents and counts them locally. Once we implement aggregate push down it will take less time to do count.

ahsanhadi commented 7 years ago

On Tue, Feb 21, 2017 at 1:50 PM, gabbasb notifications@github.com wrote:

@lifubang https://github.com/lifubang the current MongoDB FDW does not implement aggregate push down. It therefore selects all documents and counts them locally. Once we implement aggregate push down it will take less time to do count.

Aggregate pushdown in FDW machinery will be part of PG 10, we also have it on our roadmap to implement it for MongoDB FDW. The other push downs like join, sort etc will be done sooner as they are already part of PG 9.6.

You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/EnterpriseDB/mongo_fdw/issues/74#issuecomment-281281136, or mute the thread https://github.com/notifications/unsubscribe-auth/AHmqpKQ2TsIK5FRRi7DILFbVL6N0iZR6ks5reqVogaJpZM4MG05X .

-- Ahsan Hadi Snr Director Product Development EnterpriseDB Corporation The Enterprise Postgres Company

Phone: +92-51-8358874 Mobile: +92-333-5162114

Website: www.enterprisedb.com EnterpriseDB Blog: http://blogs.enterprisedb.com/ Follow us on Twitter: http://www.twitter.com/enterprisedb

This e-mail message (and any attachment) is intended for the use of the individual or entity to whom it is addressed. This message contains information from EnterpriseDB Corporation that may be privileged, confidential, or exempt from disclosure under applicable law. If you are not the intended recipient or authorized to receive this for the intended recipient, any use, dissemination, distribution, retention, archiving, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please notify the sender immediately by reply e-mail and delete this message.

ahsanhadi commented 7 years ago

Can you please add a feature request to implement aggregate pushdown to mongodb_fdw so we can close this issue...

vaibhavdalvi93 commented 2 years ago

@lifubang , Aggregate pushdown feature is already committed and it's available to use. Can you please check if it resolved you concern or not?

lifubang commented 2 years ago

Thanks. We have no opportunities to check it now. mongodb_fdw helped us for a lot, we appreciate this great project very much.