找到网上一大神方法(头晕了, 准备明天测试吧):
http://stackoverflow.com/questions/4777070/hamming-distance-on-binary-strings-in-sql
这种是32位, 分成4分, 保存在bigint类型里,
The only fast way to get decent performance is to split the content of the BINARY column in multiple BIGINT columns, each containing an 8-byte substring of the original data.
但迷惑的是, bigint远不止保存2的8次方那么大, 为什么只保存8位. 如果是非得是8位, 那我岂不是要建8个bigint类型来储存64个bit. 求大大们解惑.
http://stackoverflow.com/questions/4777070/hamming-distance-on-binary-strings-in-sql
这种是32位, 分成4分, 保存在bigint类型里,
The only fast way to get decent performance is to split the content of the BINARY column in multiple BIGINT columns, each containing an 8-byte substring of the original data.
但迷惑的是, bigint远不止保存2的8次方那么大, 为什么只保存8位. 如果是非得是8位, 那我岂不是要建8个bigint类型来储存64个bit. 求大大们解惑.
解决方案 »
- MYsql创建视图如何删除重复字段?
- mysql insert语句 怎么存储一维数组变量
- [求助]MYSQL创建触发器遇到很奇怪的问题。
- 求 全国地区名+加各地区简介 的数据库.
- <<<<<<<<<<<<<<求一个sql语句>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
- Mysql数据复制的问题
- MySql 中怎么建触发器?
- 相同的语句在两个MYSQL一个出错,一个不出错
- 急,急,急,急mysql语句中如何在一个字符串字段中加入 what's it? 内容。
- 我用"select * from subject order by ID DESC"来列出所有的记录(subject表中大概有10000条左右的记录) 请问我需要为ID来建立索引吗?我
- 为什么我输入net stop MYSQL 会没有反应呢?
- ERROR 1045 (28000): Access denied for user 'root'@'localhost'[灌水免进 有分了可以补给]
CREATE TABLE `pictures` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`filename` varchar(255) DEFAULT NULL
`time_added` varchar(255) DEFAULT NULL,
`time_update` varchar(255) DEFAULT NULL,
`hash` bit(64) DEFAULT NULL,
`hash2` bit(64) DEFAULT NULL COMMENT 'hash 180',
PRIMARY KEY (`id`),
KEY `hash` (`hash`)
) ENGINE=memory DEFAULT CHARSET=utf8;
大大们能否帮我解惑:
bigint远不止保存2的8次方那么大, 为什么只保存8位. 如果是非得是8位, 那我岂不是要建8个bigint类型来储存64个bit. 求大大们解惑.