Azu Posted October 24, 2007 Share Posted October 24, 2007 Hello.. how do I select based on bitmasks? I'm looking for something like.. select * from table where 16 in bitmask(field) Edit: and I need to make sure that it will be indexed right of course so that it won't be slow. I'm guessing that indexing this column just like I would any other should work? Or is there something special I have to do for it to work for bitmasks? Quote Link to comment https://forums.phpfreaks.com/topic/74590-select-bitmask/ Share on other sites More sharing options...
fenway Posted October 24, 2007 Share Posted October 24, 2007 You can't index a bitmask the way you're thinking. Quote Link to comment https://forums.phpfreaks.com/topic/74590-select-bitmask/#findComment-377027 Share on other sites More sharing options...
Azu Posted October 25, 2007 Author Share Posted October 25, 2007 Thanks but I don't understand. If I can't index it how do I prevent it from being slow? And what is the command I need to use for the select? Quote Link to comment https://forums.phpfreaks.com/topic/74590-select-bitmask/#findComment-377716 Share on other sites More sharing options...
fenway Posted October 25, 2007 Share Posted October 25, 2007 Thanks but I don't understand. If I can't index it how do I prevent it from being slow? And what is the command I need to use for the select? It will be slow... and you should look here for examples. Quote Link to comment https://forums.phpfreaks.com/topic/74590-select-bitmask/#findComment-378034 Share on other sites More sharing options...
Azu Posted October 26, 2007 Author Share Posted October 26, 2007 Thanks that will work ^^ I don't understand why I can't index it though.. I want it to be fast.. Would it be faster just to make add like 40 tinyint(1) rows? Quote Link to comment https://forums.phpfreaks.com/topic/74590-select-bitmask/#findComment-378348 Share on other sites More sharing options...
fenway Posted October 26, 2007 Share Posted October 26, 2007 Thanks that will work ^^ I don't understand why I can't index it though.. I want it to be fast.. Would it be faster just to make add like 40 tinyint(1) rows? How would you design such an index? It's like trying to index the 3rd and 6th letter of a CHAR field. 40 rows is a bad idea... bitmasks are a bad idea. Quote Link to comment https://forums.phpfreaks.com/topic/74590-select-bitmask/#findComment-378606 Share on other sites More sharing options...
Azu Posted October 26, 2007 Author Share Posted October 26, 2007 I don't understand then.. how do I store a bunch of On/Off values? Quote Link to comment https://forums.phpfreaks.com/topic/74590-select-bitmask/#findComment-378779 Share on other sites More sharing options...
Azu Posted October 29, 2007 Author Share Posted October 29, 2007 Is there any good way to (that won't be slow)? Quote Link to comment https://forums.phpfreaks.com/topic/74590-select-bitmask/#findComment-380131 Share on other sites More sharing options...
fenway Posted October 29, 2007 Share Posted October 29, 2007 I don't understand then.. how do I store a bunch of On/Off values? Very inefficiently... do you really need 40 for each... or does each user select a few? I usually use a name/value table. Quote Link to comment https://forums.phpfreaks.com/topic/74590-select-bitmask/#findComment-380378 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.