List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:May 24 1999 12:33am
Subject:Out of memory using order by on 19 records!
View as plain text  
>>>>> "Shafir" == Shafir  <shafir@stripped> writes:

Shafir> Hi, I'm having this strange problem as shown below:

Shafir> Q: If I am only sorting 19 rows, why is there an out of memory situation?

Shafir> mySQL seems to be sorting the entire table? is there a workaround where
Shafir> i can get mysql to sort just the results of the 1st request?

Shafir> ie a hypothetical query like:

Shafir> select * from (select * from msglist where listtime>19990516210000)
Shafir> order by runtime;

Shafir> or something like that..

Shafir> Anyone can help?


mysql> select count(*) from msglist where listtime>19990516210000;
Shafir> +----------+
Shafir> | count(*) |
Shafir> +----------+
Shafir> |       19 |
Shafir> +----------+
Shafir> 1 row in set (0.00 sec)

mysql> select * from msglist where listtime>19990516210000;
Shafir> +--------+-----------------+----------------+---------+
Shafir> | userno | ip              | listtime       | runtime |
Shafir> +--------+-----------------+----------------+---------+
Shafir> | 7868   | 24.5.181.21     | 19990516210119 | 0.00377 |
Shafir> | 7887   | 206.99.118.12   | 19990516210259 | 0.00371 |
<cut>
Shafir> 19 rows in set (0.03 sec)

mysql> select * from msglist where listtime>19990516210000 order by runtime;
Shafir> ERROR 1038: Out of sort memory. Increase daemon sort buffer size

This means that the value for the variable 'sort_buffer_size' is too
small for your table (MySQL is allocating enough memory to be able to
sort the whole table, but it will only sort the matching rows).

Try increasing sort_buffer_size from 32760 to 65536 !

Regards,
Monty
Thread
Out of memory using order by on 19 records!Shafir18 May
  • Re: Out of memory using order by on 19 records!Bill Rhodes18 May
    • Re: Out of memory using order by on 19 records!Shafir18 May
  • Re: Out of memory using order by on 19 records!Thimble Smith19 May
    • Re: Out of memory using order by on 19 records!Shafir19 May
      • Re: Out of memory using order by on 19 records!Thimble Smith19 May
        • Re: Out of memory using order by on 19 records!Shafir19 May
          • Re: Out of memory using order by on 19 records!Thimble Smith19 May
  • Out of memory using order by on 19 records!Michael Widenius24 May