سؤال

Does using property type BooleanProperty give us any performance advantage(like faster query response or anything else) compared to using another property type. The property is used as a flag(only two possible values)

I use GAE with Python

Example 1:

class H(ndb.Model): 
    p = ndb.BooleanProperty() 

Example 2:

class H(ndb.Model): 
    p = ndb.IntegerProperty() # with possible values as 0 or 1 

Is example 1 approach better in terms of performance or storage

I know, by convention, it is appropriate to use example 1 approach but i am curious to know if we get any benefits

هل كانت مفيدة؟

المحلول

A Boolean takes less space than an Integer.

You have to have millions of records, however, to notice any difference.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top