2 つのモデルに基づく数百万のアドレスがあるとします。
Addressモデルには、次のような一般的なプロパティであっても、プレーンな文字列プロパティがありますcounty。class Address(ndb.Model): house_no = ndb.StringProperty() street = ndb.StringProperty() locality = ndb.StringProperty() # City/town county = ndb.StringProperty() zipcode = ndb.StringProperty()StructuredAddressmodel は、それぞれを として定義することにより、より一般的なプロパティを他のモデルへの参照として保持しますKeyProperty。class StructuredAddress(ndb.Model): house_no = ndb.StringProperty() street = ndb.StringProperty() locality = ndb.KeyProperty(kind=Locality) # City/town county = ndb.KeyProperty(kind=County) zipcode = ndb.KeyProperty(kind=Zipcode)
質問は次のとおりです。
のような一般的なプロパティに基づいてクエリを実行する場合、どのモデルがより効率的
zipcodeですか?countyプロパティの数が約50で、プロパティの数が約100万の場合を想定しzipcodeます。何百万もの住所レコードがある場合、この場合、どのモデルがより効率的でしょうか?この例での使用
KeyPropertyは、より多くの読み取り操作を意味し、実質的に請求額が高くなることを意味しますか? 組み込みの ndb キャッシングはすでにこれを回避していますか?