My query is this:
UPDATE `phrases`
SET `phrases`.`count`=(SELECT COUNT(*) FROM `strings` WHERE `string` LIKE CONCAT('%', `phrases`.`phrase`, '%'))
My tables look like this:
CREATE TABLE `phrases` (
`hash` varchar(32) NOT NULL,
`count` int DEFAULT 0,
`phrase` text NOT NULL,
PRIMARY KEY (`hash`),
KEY(`count`)
)
And
CREATE TABLE `strings` (
`string` text NOT NULL,
)
phrases has 18,000 rows. strings has 1500 rows.