Hi Hector, Umm, it looks like you're simply doing a SELECT in the first query and *populating a new table* in the second. Of course inserting 3.3 million rows is going to take extra time! How can you even compare the 2 when they're doing different things?
Matt ----- Original Message ----- From: "Héctor Villafuerte D." Sent: Friday, October 24, 2003 12:10 PM Subject: Really slow query (compared with Visual FoxPro) > Hi all, > I'm migrating from Visual FoxPro (I'm a newbie). > On a daily basis I need to run this query on a table with a little more > than > 5 million records. > > + MS Visual FoxPro 6.0 > select tel, telefb, rutaentran, rutasalien, sum(minutos) as minutos from > traf_oper > group by 1, 2, 3, 4 into table oper_grp > This took about 173 seconds (let's say 3 minutes) > > + MySQL 4.1.0-alpha-max-nt > mysql> create table oper_grp select tel, telefb, rutaentran, rutasalien, > -> sum(minutos) as minutos from traf_oper group by 1, 2, 3, 4; > Query OK, 3301017 rows affected (8 hours 36 min 48.83 sec) --->>> 516 > minutes! > Records: 3301017 Duplicates: 0 Warnings: 0 > > Why is there such a big difference?! Any optimization tips I could follow? > Thanks in advance, > Hector -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]