grahamearley / FirestoreGoogleAppsScript

A Google Apps Script library for accessing Google Cloud Firestore.
http://grahamearley.website/blog/2017/10/18/firestore-in-google-apps-script.html
MIT License
648 stars 109 forks source link

Poor performance when updating thousands of data #168

Open risalfajar opened 1 year ago

risalfajar commented 1 year ago

Explain the Problem in Detail

I have thousands of items that I want to update. Currently, there's only updateDocument() API available, which only updates a single data. Since Apps Script doesn't support parallelization (CMIIW), our only option is to call updateDocument() multiple times synchronously, which is very bad for performance.

Do you have any solution/workaround for this?

Library Version: 33
abkarino commented 1 year ago

You would need to use a batchWrite operation which would encapsulate up to 500 writes. However, this feature is not available in this repo yet. There is a Pull Request already open for that.

MichaelJoo commented 1 year ago

when is the batchWrite function coming along? I am also having the same problem. I need to run hundreds of the app script function...

abkarino commented 1 year ago

I have no clue. https://github.com/grahamearley/FirestoreGoogleAppsScript/pull/144 I was just checking if there has been any updates recently in this repo.

MichaelJoo commented 1 year ago

Just posted my issue in SO - https://stackoverflow.com/questions/77289105/create-or-update-firestore-collection-based-on-google-app-script

abkarino commented 1 year ago

I already have that feature deployed on my fork, you can use it from there or you can do a new fork and deploy it to your own script.

risalfajar commented 1 year ago

I don't think this library is still maintained, the last release is three years ago.

@grahamearley would you confirm on this?

MichaelJoo commented 1 year ago

I already have that feature deployed on my fork, you can use it from there or you can do a new fork and deploy it to your own script.

Installed your V4 library and it works like a charm :)

LaughDonor commented 1 year ago

I don't think this library is still maintained, the last release is three years ago.

@grahamearley would you confirm on this?

I apologize on the lack of maintenance. I have scheduled time to work on this within the coming week to address and catch up to all the issues. I'm aware of @abkarino's changes and should be incorporating them into a release as well. Thanks for your patience! :)

risalfajar commented 3 months ago

@LaughDonor It has been almost 1 year, do you have any problem?

MichaelJoo commented 2 months ago

Any updates on this? I am now importing @abkarino 's batch function again, which works well.