我目前正在执行以下连接,执行查询需要很长时间,有没有办法让它运行得更快?我在表中有 23 个字段。我在字段 'id' (int) 5 reg (varchar) 9 上有一个主键
SELECT a1.*, ( SELECT COUNT(reg) FROM auction a2 WHERE reg = a1.reg) AS c1 FROM auction a1
CREATE TABLE IF NOT EXISTS `db1` (
`id` int(5) unsigned NOT NULL AUTO_INCREMENT,
`adate` varchar(10) NOT NULL,
`lnu` int(4) NOT NULL,
`reg` varchar(9) NOT NULL,
`mk` varchar(50) NOT NULL,
`mod` varchar(50) NOT NULL,
`type` varchar(25) NOT NULL,
`ree` varchar(50) NOT NULL,
`co` varchar(50) NOT NULL,
`fu` varchar(20) NOT NULL,
`tran` varchar(20) NOT NULL,
`mt` varchar(9) NOT NULL,
`mile` int(6) NOT NULL,
`ree` int(6) NOT NULL,
`apv` int(6) NOT NULL,
`ds` int(2) NOT NULL,
`sr` varchar(50) NOT NULL,
`sen` int(10) NOT NULL,
`keep` int(2) unsigned NOT NULL,
`tmp` char(1) DEFAULT NULL,
`rk` varchar(100) DEFAULT NULL,
`st` varchar(3) DEFAULT NULL,
`dd` varchar(10) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `date` (`adate`)