0

I have a query running on a large table that worked when I did limit 100. When I remove the limit I get:

[Err] 126 - Incorrect key file for table '/tmp/#sql_5e2d_6.MYI'; try to repair it

I checked with server admin basically the /tmp file fills up quickly.

Is there a way to set up the query to flush the table as it goes along? Or run say 100 records, stop, re-run? The query is pretty simple:

select distinct a, 
       min(b)   N_b
from K
group by a;

At the end of the day what I am trying to do is delete from a large table duplicate records, keeping the record with the lowest value in b. This was the initial select statement.

Sheepy
  • 17,324
  • 4
  • 45
  • 69
user3649739
  • 1,829
  • 2
  • 18
  • 28

1 Answers1

0

You can use something like, *** Edit according to the language you use.

$sql = true;
int i = 0;

While($sql){

$sql = "select distinct a, 
       min(b)   N_b
from K
group by a LIMIT i, i+99";
//Do whatever you want.
i=i+100;
}