MySQL Forums
Forum List  »  MyISAM

Re: Outfile Using too much disk space
Posted by: Rick James
Date: October 16, 2010 10:57AM

And if it had been utf8, it would be 3*255 instead of 255.

Interesting. I would have expected it to be smarter in the sorting.

What version of MySQL?

Here is roughly what the steps are. (I think of 'buffer' as something in RAM, so I won't use that term.)

1. Table scan to find the rows of interest (WHERE...); put results into a temp MyISAM table.
2. Sort that temp table (ORDER BY...).
3. Write the output to the OUTFILE.

The 81GB is excessive, and it seems excessive to need 4 * 81GB.

SHOW VARIABLES LIKE 'character%'; -- wondering if it is switching to utf8.
SHOW VARIABLES LIKE '%table%';
EXPLAIN SELECT ...;

I guess your test case gives a strong indication that VARCHAR(255) is _not_ necessarily the same as VARCHAR(20).

If you need to do this task a lot, suggest you add
INDEX(customer_id, member_id)

Options: ReplyQuote


Subject
Views
Written By
Posted
4476
October 07, 2010 11:49AM
1703
October 10, 2010 12:50PM
2301
October 12, 2010 12:38PM
1605
October 14, 2010 11:21AM
Re: Outfile Using too much disk space
1614
October 16, 2010 10:57AM
2031
November 23, 2010 04:57PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.