Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



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

Posts: 196
Trades: 0
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
 
 
Register now for full access!
Old 03-04-2008, 04:37 PM Re: ORDER BY causing disk space error
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
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.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 03-04-2008, 10:13 PM Re: ORDER BY causing disk space error
Ultra Talker

Posts: 366
Name: Steve
Location: Miami, FL, Earth
Trades: 0
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,
Please login or register to view this content. Registration is FREE

Last edited by smoseley; 03-04-2008 at 10:14 PM..
smoseley is offline
Reply With Quote
View Public Profile Visit smoseley's homepage!
 
Old 03-06-2008, 02:26 AM Re: ORDER BY causing disk space error
Ultra Talker

Posts: 310
Trades: 0
Do you have an index created on dataname field, if not then
create an index on dataname field and try again.
dman_2007 is offline
Reply With Quote
View Public Profile
 
Old 03-07-2008, 02:53 AM Re: ORDER BY causing disk space error
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
Also can you show what does 'explain select ...' tell you about this query?
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

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 Search this Thread
Search this Thread:

Advanced Search

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

BB 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.28782 seconds with 12 queries