in reply to Check boxes
The easiest way in terms of SQL would be to have an extra boolean column for each feature. The way you're doing it is certainly the most compact but depending on how many rows you have it can get very slow because the DB has to do a full table scan for each query. And then as you have noticed you run into problems when you need more bits than the largest integer type has. As far as I know there's no nice workaround for >64 features, only ugly ones like splitting them up in "extri" and "extri2" or something. Of course BLOBs could be as big as you like but the boolean operators don't work on them.
If your database server is on the same machine as the application, you could just select everything and do the filtering in Perl, I don't think it would be much slower than doing the same in SQL. Though that goes against pretty much the entire idea of a relational database ...
In the end I'd say you'd be best off to use individual columns. With TINYINTs that would be some 100 bytes per row on MySQL and probably less on Postgres, not that much for all the advantages it brings.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Check boxes
by bitingduck (Deacon) on May 29, 2012 at 05:50 UTC | |
by mbethke (Hermit) on May 29, 2012 at 06:15 UTC |