FirestoreGoogleAppsScript icon indicating copy to clipboard operation
FirestoreGoogleAppsScript copied to clipboard

Poor performance when updating thousands of data

Open risalfajar opened this issue 1 year ago • 10 comments

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

risalfajar avatar Oct 09 '23 04:10 risalfajar

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.

abkarino avatar Oct 12 '23 23:10 abkarino

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

MichaelJoo avatar Oct 13 '23 15:10 MichaelJoo

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.

abkarino avatar Oct 13 '23 15:10 abkarino

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

MichaelJoo avatar Oct 13 '23 15:10 MichaelJoo

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.

abkarino avatar Oct 13 '23 16:10 abkarino

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

@grahamearley would you confirm on this?

risalfajar avatar Oct 14 '23 00:10 risalfajar

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 :)

MichaelJoo avatar Oct 14 '23 04:10 MichaelJoo

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! :)

LaughDonor avatar Oct 16 '23 14:10 LaughDonor

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

risalfajar avatar Aug 13 '24 03:08 risalfajar