stackoverflow
Case:
<pre>
CREATE TABLE `comment2` (
`id` int(11) NOT NULL,
`user` int(11) NOT NULL,
`text` varchar() NOT NULL,
`ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
<br>
ALTER TABLE `comment2`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `id` (`id`,`user`);
<br>
ALTER TABLE `comment2`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
</pre>
There are 1000000 write operations per second in table 'comment2'.
<br>
And 100000 queries `SELECT user, text FROM comment2 LIMIT 100;`
<br>
<br>
Any suggestions on how it could be optimized?
<pre>
CREATE TABLE `comment2` (
`id` int(11) NOT NULL,
`user` int(11) NOT NULL,
`text` varchar() NOT NULL,
`ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
<br>
ALTER TABLE `comment2`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `id` (`id`,`user`);
<br>
ALTER TABLE `comment2`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
</pre>
There are 1000000 write operations per second in table 'comment2'.
<br>
And 100000 queries `SELECT user, text FROM comment2 LIMIT 100;`
<br>
<br>
Any suggestions on how it could be optimized?
Комментарии
Отправить комментарий