Temp file error

I am trying to run a graph simply to extarct three columns from a table in MySql. The table has little over 4 million rows. I am getting this error. If I limit in 100000

Error writing file ‘/tmp/MYfS3dok’ (Errcode: 28).

Thanks,
Kasturi

Hello Kasturi,
MySQL can create large temporary files, when reading data from the database. This error points to a lack of disk space to be able to store the query results (see http://lists.mysql.com/mysql/214982).
Following is the extract from the MySQL thread:

  • your tmp folder is limited - try to remove the limit or instruct MySQL to use different location: [list:3q5n92go][*:3q5n92go]Add the location to MySQL configuration file:
[mysqld]  
tmpdir=/path/to/space  

[/*:m:3q5n92go]

  • you can make MySQL to use memory for creating temp files rather than disk
    [*:3q5n92go] set sort_buffer_size=1024*1024*100
    [/*:m:3q5n92go]
  • you have where or order by clause in your query but no index on the field(s) - the server must first sort all qualifying rows. This is where it needs so much space.
    [/list:u:3q5n92go]

Agata,
As always, thank you for your response. I really appreciate it.
Regards,
Kasturi