GAE/J 数据存储:存储空值与缺失值

发布于 2024-10-10 15:08:51 字数 143 浏览 0 评论 0 原文

任何人都可以确认存储具有空值的属性是否比不存储任何内容(即缺失值)最有效(就数据存储使用和配额而言)?

这么想似乎是合理的,在这种情况下,我想知道在使用 JDO/JPA 时如何避免存储属性值而不是空值。我只能避免使用数据存储低级 API 来存储给定的属性。

Anyone can confirm if storing a property with a null value is most effective (in terms of datastore usage and quotas) than not storing anything at all (that is, a missing value) ?

It seems reasonable to think so and, in that case, I'd like to know how to avoid storing a property value instead of a null value when using JDO/JPA. I've only been able to avoid storing a given property with the datastore low level API.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

天冷不及心凉 2024-10-17 15:08:51

我相信不存储属性将为您节省少量的磁盘配额,但我不确定这是否值得付出努力,除非这些“可选”属性的数量与“始终存在”属性的数量相比很大。

当然,您可以通过使用低级 API 创建 2 组示例数据并检查 统计 页面以查看数据存储中大小的差异。

需要注意的一个问题是,据我所知,您无法查询所有没有拥有属性的实体。

I believe that not storing a property will save you a small amount of disk quota, but I'm not sure it is worth the effort, unless the amount of these "optional" properties is large compared to the amount of "always there" properties.

Of course, you can do a simple test by creating 2 sets of sample data using the low level API, and checking the Stats page to see how the sizes differ in the datastore.

One gotcha to be aware of is that AFAIK you can't query for all entities that don't have a property.

枫以 2024-10-17 15:08:51

存储 null 有其成本。

它们是 2 个写入操作,数据也很少,如果属性名称与其他实体相同,我想该名称位于字典中,并且每个属性存储一个指针来获取名称。

https://developers.google.com/appengine/docs/java/datastore /entities#Java_Understanding_write_costs

Storing null have their costs.

They are 2 writes operations and little data too, if the property name is in common with others entities, I suppose the name is in a dictionary and each property store a pointer to get the name.

https://developers.google.com/appengine/docs/java/datastore/entities#Java_Understanding_write_costs

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文