Size of int in datastore

73 views
Skip to first unread message

Ashley Finney

unread,
Mar 3, 2015, 5:09:47 AM3/3/15
to google-a...@googlegroups.com
Hi all,

If the size of int is machine dependant, how many bytes are used when int is specified as a datastore field?
Will this change depending on the machine that stored the entity?  Or are int fields stored as size independent type?

Specifically I'm using Go if that matters.

Many thanks,
Ash.

Alex Martelli

unread,
Mar 3, 2015, 9:56:45 AM3/3/15
to google-a...@googlegroups.com
In as much as protocol buffers are used in the underlying, #bytes depend on the exact value of the integer -- see https://developers.google.com/protocol-buffers/docs/encoding .


Alex

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To post to this group, send email to google-a...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/8972c160-c0c7-4a0a-8dc9-0e9972a49b2e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jeff Schnitzer

unread,
Mar 3, 2015, 1:09:59 PM3/3/15
to Google App Engine
GAE/Java stores all integer numbers as 64 bit protobuf values. I presume all other runtimes do the same, otherwise there would be compatibility problems when reading from the datastore.

Jeff

Alex Martelli

unread,
Mar 3, 2015, 1:32:42 PM3/3/15
to google-a...@googlegroups.com
On Tue, Mar 3, 2015 at 10:09 AM, Jeff Schnitzer <je...@infohazard.org> wrote:
GAE/Java stores all integer numbers as 64 bit protobuf values. I presume all other

That's what is seen at the application-programming interface layer.  What's actually *stored* may take a different number of bytes, as per protobuf "wire"-level layouts.

runtimes do the same, otherwise there would be compatibility problems when reading from the datastore.

Yes, the RPCs to/from the datastore are uniform and don't vary with the application programming language (so, what you can store into, and retrieve from, an "integer property", is uniformly a 64-bit signed integer value).  That does not necessarily mean it will take the backend exactly 8 bytes to store it ("how many bytes are used" as it's stored).

Alex

Layo

unread,
Mar 5, 2015, 11:39:27 AM3/5/15
to google-a...@googlegroups.com
Hi Ashley,

Cloud Datastore uses 8 bytes to store signed integers, this independent from the machine. More info about Datastore types.
Reply all
Reply to author
Forward
0 new messages