Reply
ORDER BY causing disk space error
Old 03-04-2008, 01:53 PM ORDER BY causing disk space error
Super Talker

Posts: 139
The following query is causing a mysql error The Error number is 28, which means low disk space. So I clear some space, retry and get the error again after a few times querying. After playing with query i find that the ORDER BY statement is what make it fail. If i remove it the script runs.

So my question is, is there something about an ORDER BY statement that takes up a lot of disk space? I can sort in PHP, but if MySQL has the ability then i prefer it to sort with.

Thanks for all the suggestions.

Quote:
SELECT data.datasize AS size, data.dataid AS id, data.datatype, data.dataname, data.datadescription AS description, data.engineerid AS owner, datalog.usability AS usability,datalog.easeofdownload AS easeofdownload, datalog.docaccuracy AS accuracy, datalog.timesdownloaded AS timesd, datalog.ratings AS ratings from data, datalog where data.datatype = 'AE Training video' AND data.dataid = datalog.dataid ORDER BY data.dataname
empiresolutions is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 03-04-2008, 03:37 PM Re: ORDER BY causing disk space error
Learning Newbie's Avatar
Moderator

Latest Blog Post:
What’s He Looking At?
Posts: 4,986
Name: John Alexander
Yeah, order by means sort, which means resequencing data after it's gathered. This forces your server to allocate temp space so as not to have to do it in memory. You may be able to use a query hint to force a different execution plan, but if the result set is large enough, your hint probably won't be honored anyway.

This is an example of why people should switch away from MySQL.
__________________
4 ways to improve the lives of the "bottom billion"

"HEY YOU KIDS GET OFF MY LAWN!" -John McCain
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 03-04-2008, 09:13 PM Re: ORDER BY causing disk space error
Skilled Talker

Posts: 51
Not related to the original question, but try switching to ANSI-92 query style and use table aliases to save yourself some headache.

And don't alias data on output with the same name as the column name... that's redundant. Personally, I don't recommend aliasing any column names on output. It gets confusing when working with large databases.
Code:
SELECT 
    d.datasize AS size, 
    d.dataid AS id, 
    d.datatype, 
    d.dataname, 
    d.datadescription AS description, 
    d.engineerid AS owner, 
    dl.usability, 
    dl.easeofdownload, 
    dl.docaccuracy AS accuracy, 
    dl.timesdownloaded AS timesd, 
    dl.ratings
FROM data AS d
    INNER JOIN datalog AS dl ON d.dataid = dl.dataid
WHERE d.datatype = 'AE Training video'
ORDER BY d.dataname
__________________
- Steve

President, Transio - Miami Web Developers

Last edited by smoseley : 03-04-2008 at 09:14 PM.
smoseley is offline
Reply With Quote
View Public Profile
 
Old 03-06-2008, 01:26 AM Re: ORDER BY causing disk space error
Ultra Talker

Posts: 308
Do you have an index created on dataname field, if not then
create an index on dataname field and try again.
__________________
tiny url
dman_2007 is offline
Reply With Quote
View Public Profile Visit dman_2007's homepage!
 
Old 03-07-2008, 01:53 AM Re: ORDER BY causing disk space error
mtishetsky's Avatar
Super Spam Talker

Posts: 972
Name: Mike
Location: Mataro, Spain
Also can you show what does 'explain select ...' tell you about this query?
__________________
Free Mobile Phone Themes

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Reply     « Reply to ORDER BY causing disk space error
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.14826 seconds with 13 queries