I like to use bit fields for status flag information, using a simple
attributes unsigned NOT NULL default '0'
column.
I used to use the set datatype for this, but
- there is no simple "set a bit" or "turn off a bit" function for the set datatype (one has to use bitwise operations, anyway)
- reading set data from selects requires string processing
- one has to use alter table when a new flag is added (which is quite a penalty on large databases)
Nonetheless, both the set datatype and a simple int bitfield as described above both have a major disadvantage: One cannot use an index to speed up queries such as
select * from bla where attributes & 1;
Are there any plans to add a special key type for bit fields (just as there is a special key type for full-text search now)?
Or is there a key type for sets by now? ([1] claims there isn't.)
Thanks,
Hanno
[1] http://www.vbmysql.com/articles/mysqlsetdatatype.html
-- Hanno Müller, Dipl.-Inform.
epublica GmbH http://www.epublica.de Tel. +49 (0)40/4109879-4
Open Business Club - Mitglied werden: http://www.openbc.com/go/invanon/2
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]