Reputation: 41
I have 3,090,590 rows in a message column and I am using this code to get 3000 rows at a time.
I am trying to convert my SQL to NoSQL, for this I wrote a PHP script with Ajax. Ajax requests $page
every time by multiplying; for e.g. 3000, 9000, 12000...
SELECT * FROM mesajciklar order by id ASC LIMIT $page,3000
Somehow, even if I limit the query it always scans full the table which makes MySQL use 100% of the available CPU. I have full indexing of every column but it's still so slow.
Could you please show me a way how to optimize it?
mysql> | mesajciklar | CREATE TABLE `mesajciklar` (
-> `id` int(11) NOT NULL AUTO_INCREMENT,
-> `sira` int(11) NOT NULL DEFAULT '0',
-> `mesaj` text NOT NULL,
-> `yazar` varchar(255) NOT NULL DEFAULT '',
-> `ip` varchar(255) NOT NULL DEFAULT '',
-> `tarih` varchar(255) NOT NULL DEFAULT '',
-> `gun` int(11) NOT NULL DEFAULT '0',
-> `ay` int(11) NOT NULL DEFAULT '0',
-> `yil` int(11) NOT NULL DEFAULT '0',
-> `saat` varchar(255) NOT NULL DEFAULT '',
-> `oy` varchar(255) NOT NULL DEFAULT '',
-> `update2` varchar(255) NOT NULL DEFAULT '',
-> `updater` varchar(255) NOT NULL DEFAULT '',
-> `updatesebep` varchar(255) NOT NULL DEFAULT '',
-> `statu` varchar(255) NOT NULL DEFAULT '',
-> `silen` varchar(255) NOT NULL DEFAULT '',
-> `silsebep` varchar(255) NOT NULL DEFAULT '',
-> PRIMARY KEY (`id`),
-> UNIQUE KEY `id` (`id`) USING BTREE,
-> KEY `sira` (`sira`),
-> KEY `yazar` (`yazar`),
-> KEY `ip` (`ip`),
-> KEY `tarih` (`tarih`),
-> KEY `gun` (`gun`),
-> KEY `ay` (`ay`),
-> KEY `yil` (`yil`),
-> KEY `saat` (`saat`),
-> KEY `oy` (`oy`),
-> KEY `update2` (`update2`),
-> KEY `statu` (`statu`),
-> KEY `silsebep` (`silsebep`),
-> KEY `gun_2` (`gun`,`ay`,`yil`),
-> FULLTEXT KEY `mesaj` (`mesaj`),
-> FULLTEXT KEY `yazar_2` (`yazar`)
-> ) ENGINE=MyISAM AUTO_INCREMENT=1062473327 DEFAULT CHARSET=latin5 |
Upvotes: 0
Views: 251