pythongoogle-app-enginegoogle-cloud-datastoreentity-group-transactionsnosql

Google App Engine - Saving User Records Quickly to Datastore, Transactions, Entity Groups


We have thousands of users, each with 1000 records. Both users and records are represented by models in our application.

Saving 1000 records individually per user takes ages (30+ seconds). However, considering all of these records belong to the same user, can be save them all in one go?

As I understand it, using Entity Groups, it could be all done in one transaction, but can't find any clear documentation on how to do this.

Any suggestions?


Solution

  • Transactions do not make processing faster. If anything, they are slower.

    You can speed up processing by saving entities in batches (up to 1,000 entities per call).