Least Expensive Way to Delete Entities

130 views
Skip to first unread message

Patrick Twohig

unread,
Dec 19, 2011, 12:50:42 PM12/19/11
to google-a...@googlegroups.com
Hi,

I have a bit of old data that I want to clean out.  I tried to write a fanout operation to clean out some of the old data, but it's actually manged to run out my budget in a few hours.  I'm curious if there would be a way to delete huge amounts of old data that isn't needed anymore.  Is there a tool or something that i can use to efficiently purge entity groups from my application?  Any help would be greatly appreciated.

Thanks,
Patrick.

--
Patrick H. Twohig.

Namazu Studios
P.O. Box 34161
San Diego, CA 92163-4161

Ikai Lan (Google)

unread,
Dec 19, 2011, 4:18:45 PM12/19/11
to google-a...@googlegroups.com
One thing you can do is making this really slow. The free quota actually gives you quite a bit of quota (if your app is relatively small) so if you can stretch out your job you can purge a relatively small datastore at low cost.

I suspect what makes this expensive is datastore ops, not instance hours. Deleting an entity with 10 properties is 21 writes! There's not a lot we can do there ...

--
Ikai Lan 
Developer Programs Engineer, Google App Engine



--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.

supercobra

unread,
Dec 20, 2011, 7:47:19 AM12/20/11
to google-a...@googlegroups.com
Could you explain (again?) how a deletion of an entity w/ 10- property is 21 writes?

Brian Quinlan

unread,
Dec 20, 2011, 7:58:46 AM12/20/11
to google-a...@googlegroups.com
I think that Ikai made an off-by-one-error: it requires 22 writes
assuming that every property is indexed :-)

Check out "Entity Delete (per entity)" at:
http://code.google.com/appengine/docs/billing.html#Billable_Resource_Unit_Cost

Cheers,
Brian

voscausa

unread,
Dec 20, 2011, 10:25:29 AM12/20/11
to google-a...@googlegroups.com
You van use a daily cron job to delete parts of the old stuff and stay within your quota. In this way you can make use of your free new quota every day. Maybe it is not cheaper, but you stay within tour quota.
And ofcourse use batch delete.

Ikai Lan (Google)

unread,
Dec 20, 2011, 1:39:37 PM12/20/11
to google-a...@googlegroups.com
Guess I forgot about the "EntitiesByKind" index:


Yes, the correct number should be 22 datastore writes.

--
Ikai Lan 
Developer Programs Engineer, Google App Engine



SP

unread,
Jun 5, 2014, 7:10:37 AM6/5/14
to google-a...@googlegroups.com, ika...@google.com
Hi Ikai, 

In traditional RDBMS like Oracle, MySQL, there is truncate command to truncate a table. It is very light in term of resource usage.

Do we have similar feature to truncate a kind in datastore? Such a feature would make housekeeping old data a lot more efficient. The lack of such feature would be a major bottleneck that prevents us from moving our serious business apps to App Engine. 

Regrards, 
SP

Jason Collins

unread,
Jun 7, 2014, 9:33:01 AM6/7/14
to google-a...@googlegroups.com, ika...@google.com
+1, this feature is really needed.

For us, truncation by namespace works best, though truncation of an entire Kind would also be a useful dimension. 

We're happy to "soft-truncate" the data - i.e., simply have it marked for deletion so that we can piggy-back on some other background process that is inexpensive for Google and have it finally be deleted days/weeks later.

j
Reply all
Reply to author
Forward
0 new messages