Design: how to store lots of booleans? What is the most optimal way to store lots (up to 300) of properties about an object? All properties determinate presence of a factor. Like, "has dog", "has cat", "has garden", "has N".

Initially I was thinking about a table with 300 columns:

create table my_objects (
    has_dog enum('0','1') NOT NULL,
    has_cat enum('0','1') NOT NULL,
    has_garden enum('0','1') NOT NULL
);


Don't bother the relevance of the enum type, it's there only for extra self-explanatory reasons.

But having those has_ x 300 columns makes my guts feel nervous.

Any advice is much appreciated.

EDIT

Since many people started asking correct questions, here's the additional info:


The db will mostly exclusively handle SELECT queries. Selects consist of combination of has_{prop} = 0|1 AND/OR has_{prop} = 0|1. Like heavy filtering.
There will be Sphinx/Solr layer on top of db.
The amount of properties is constant. So if there's one row in table my_objects, it will have those 300 columns filled, either with default values, or defined.
my_objcets table will hold no more than 1 mil of objects.
"Just" 300? That might not really be a problem, actually. How many rows do you expect in the table? If not that many, say, less than a million, then doing that might not be a huge problem.

Or if you're using PostgreSQL, as noted, you can use an array of booleans. That, I think, would be preferrable to putting each column individually in the schema.

The "best" way, however, would be a bitfield. Say, an array of a hundred 4-byte integers, with each value being one of the bits in one of those fields.  So your application could have a map of tupes, something like:

has["dog"] = (25, 18)


Noting that 'dog' would be in the 26th field (zero based), in the 19th bit. When you want to query if a record has a dog, you'd need to pull the appropriate tuple and construct an SQL statement like...

(fieldNum, bitNum) = has["dog"] # python syntax

SELECt * from tbl WHERE (has[fieldNum] &amp; (1&lt;&lt;bitNum)) &gt; 0


Finally, Postgres also has bit strings, which I've never used, but it looks like they might do the job as well. http://www.postgresql.org/docs/9.4/interactive/datatype-bit.html