2
我正在編程一個商業數據庫,然後超過20M記錄的項目。 這是表結構:大型MYSQL數據庫的問題
CREATE TABLE IF NOT EXISTS `business` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`rdate` datetime NOT NULL,
`valid` int(1) NOT NULL,
`visible` int(1) NOT NULL,
`lockItem` int(1) NOT NULL,
`parent` int(10) NOT NULL,
`titleENG` varchar(254) COLLATE utf8_bin NOT NULL,
`address` varchar(254) COLLATE utf8_bin NOT NULL,
`city` varchar(254) COLLATE utf8_bin NOT NULL,
`state` varchar(254) COLLATE utf8_bin NOT NULL,
`zipCode` varchar(254) COLLATE utf8_bin NOT NULL,
`country` varchar(254) COLLATE utf8_bin NOT NULL,
`webAddress` varchar(254) COLLATE utf8_bin NOT NULL,
`phone` varchar(254) COLLATE utf8_bin NOT NULL,
`fax` varchar(254) COLLATE utf8_bin NOT NULL,
`contact_name` varchar(254) COLLATE utf8_bin NOT NULL,
`contact_title` varchar(254) COLLATE utf8_bin NOT NULL,
`contact_gender` enum('','male','female') COLLATE utf8_bin NOT NULL,
`company_employee` varchar(254) COLLATE utf8_bin NOT NULL,
`text` text COLLATE utf8_bin NOT NULL,
`bigPic` varchar(254) COLLATE utf8_bin NOT NULL,
`keywords` varchar(254) COLLATE utf8_bin NOT NULL,
`lowerTitle` varchar(256) COLLATE utf8_bin NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`),
KEY `visible` (`visible`),
KEY `parent` (`parent`),
KEY `valid` (`valid`),
KEY `titleENG` (`titleENG`),
KEY `state` (`state`),
KEY `country` (`country`),
KEY `city` (`city`),
KEY `keywords` (`keywords`),
FULLTEXT KEY `titleENG_2` (`titleENG`),
FULLTEXT KEY `lowerTitle` (`lowerTitle`),
FULLTEXT KEY `phone` (`phone`),
FULLTEXT KEY `city_2` (`city`),
FULLTEXT KEY `state_2` (`state`),
FULLTEXT KEY `business_search` (`lowerTitle`,`phone`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=12409005 ;
我的一些疑問我正在通過全文做的,不知道如果我可以通過像使用和使用較低()函數等」,但高速。
有人可以給我一些建議嗎?
你能提供你想優化的查詢的例子嗎? –
你有沒有試過做過這些查詢,如果是的話,你遇到了什麼速度問題? –
查詢示例: SELECT id,city,state FROM business匹配(城市)反對(\'Homer \'BOOLEAN模式)GROUP BY城市,州限制10 需要5秒的東西......但我不能使用小寫和搜索就像這樣:「homer」 – John