문제

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