I am running mySQL Server 5.0.37 on a Windows 2003 Server.

I have a table that I want sorted by three columns (column1, then column2, then column3).

I can sort one column just fine. But, if the recordset is large, sorting by two (or more) columns crashes the mySQL Server Service.

Through research it looks like I am having a memory problem as the following error message is written to the MySQL error log:

080325 14:27:10 [ERROR] C:\SWsoft\Plesk\Databases\MySQL\bin\mysqld-nt.exe: Out of memory; restart server and try again (needed 32776 bytes)

The my.ini file shows the following values:

sort_buffer_size=256K
sort_buffer=256K

Oddly enough, phpMyAdmin shows the following:

sort buffer size 32,776

I increased the sort_buffer_size and sort_buffer in my.ini to 512k, but this did not help.

I am also concerned that if I successfuly increase the buffer sizes too big, I will have problems with my Windows Server (512MB) if I have a large number of users running this query at the same time.

Any help on how I can resolve this would be greatly appreciated.

You might want to investigate indexing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.