3 ms·
'0' and '1', while not ideal, seems fine to maintain? There is not even a true SQLite boolean type. Then again, I have been subjected to Oracle nonsense for to
by 3eb7988a1663 3mo ago
'0' and '1', while not ideal, seems fine to maintain? There is not even a true SQLite boolean type.
Then again, I have been subjected to Oracle nonsense for too long and have had to accept all of the boolean alternatives: 0,1,'0','1',Y,N,y,n,YES,NO,T,F, etc
- chasil 3mo agoWhen you need many booleans on a table, use an integer with bitwise and/or to record them as powers of 2. I have done this many times. Function-based indexes are necessary if they must be searched.
- echoangle 3mo agoWhy would you do that? To save some bytes in storage?
- chasil 3mo agoThe largest table where I've done this had over 50 of these booleans. That's one 64-bit number, or 50 different columns.
- echoangle 3mo agoBut if you do the function based index, you actually increase the stored size, right? Seems like a microoptimization to me that I would only do if I really have to.
- chasil 3mo agoFor the searched column only? If you are greatly concerned, SQL Server and the Sybase database from which it emerged have a native boolean data type. Another benefit of this scheme is that adding another boolean means using the next power of 2 in the existing integer, assuming room remains. No new column necessary.
- mort96 3mo agoWhen the column is an integer column, you don't want strings in it.