Compound Key Performance For App Engine Datastore -



Compound Key Performance For App Engine Datastore -

i creating string datastore ids entity "a" auto-generated ids of entity "b." should prefix id "a-prefix"-b.intid() or go b.intid()+"a-prefix?"

i assume should start b id because uniformly distributed prevent hotspots?

from https://cloud.google.com/developers/articles/balancing-strong-and-eventual-consistency-with-google-cloud-datastore

anti-pattern #1: sequential numbering of entity keys

thanks, andrew

you not need prefix @ all. key consists of entity kind , id. 2 entities may have same id , still have unique keys if belong different kinds.

this illustration works fine (example in java):

entity userentity = new entity("user"); long id = datastore.put(userentity).getid(); entity loginentity = new entity("login", id); datastore.put(loginentity);

note if take long id , convert string, keys take much more space. using long id improve option.

google-app-engine gae-datastore

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -