javagoogle-app-enginejdo

App Engine unencoded String as key -- is there an upper bound on the string length?


Suppose we have a JDO entity that uses an unencoded string as the PrimaryKey. Is there some practical limit on the size that this unencoded string could be? Specifically, I'm wondering if I could use a String that is extremely large, e.g. 500+ KB in size.

I understand the app engine quotas on in-memory object size (1MB) and datastore entity size (32MB), I'm wondering about the key field itself. Before you start ripping me for bad design and telling me to use entity relationships, this is a theoretical question, and is something that I don't intend to abuse.


Solution

  • In Python a key name is limited to 500 characters. The limit should be pretty easy to test in Java as well.

    Having a super long key name is not a good idea though. It would cause your indexes to consume a lot more space and probably increase write overhead.

    See How Entities and Indexes are Stored for more details.