Re: large temp files created by mysql

2012-05-24 Thread Luis Daniel Lucio Quiroz
I got a solution maybe step 1: mysql explain select * from users; ++-+---+--+---+--+-+--+--+---+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |

RE: large temp files created by mysql

2012-05-24 Thread Rick James
- From: Luis Daniel Lucio Quiroz [mailto:luis.daniel.lu...@gmail.com] Sent: Thursday, May 24, 2012 12:00 AM To: Jan Steinman Cc: mysql@lists.mysql.com Subject: Re: large temp files created by mysql I got a solution maybe step 1: mysql explain select * from users

RE: large temp files created by mysql

2012-05-24 Thread Luis Daniel Lucio Quiroz
Subject: Re: large temp files created by mysql I got a solution maybe step 1: mysql explain select * from users; ++-+---+--+---+--+-+--- ---+--+---+ | id | select_type | table | type | possible_keys | key | key_len | ref

Re: large temp files created by mysql

2011-10-30 Thread Jan Steinman
From: mos mo...@fastmail.fm At 10:34 AM 10/24/2011, you wrote: select id from table order by rand() limit 1; is doing as example a dumb temporary table with the full size Because it has to sort the entire table, then it returns the one row. This of course is extremely inefficient. :)

Re: large temp files created by mysql

2011-10-30 Thread Jan Steinman
Actually, having tried that, you still need the ORDER BY RAND() in there. Otherwise, I keep getting the same record over and over. But it surely cuts way down on the number of rows that need to be sorted. So if your table size is fairly stable, and you pick a good number for the WHERE

Re: large temp files created by mysql

2011-10-26 Thread Reindl Harald
Am 26.10.2011 05:14, schrieb mos: It is not braindead. You told MySQL to sort by rand() which is a non-indexed column. It needs to assign a value to each row of the result set (all ids of the table) and sort it to get the lowest random number. This is very inefficient for large

Re: large temp files created by mysql

2011-10-25 Thread Reindl Harald
Am 25.10.2011 05:45, schrieb mos: At 05:31 PM 10/24/2011, Reindl Harald wrote: Am 24.10.2011 23:31, schrieb mos: At 11:32 AM 10/24/2011, Reindl Harald wrote: Am 24.10.2011 18:02, schrieb mos: At 10:34 AM 10/24/2011, you wrote: select id from table order by rand() limit 1;

Re: large temp files created by mysql

2011-10-25 Thread mos
At 03:32 AM 10/25/2011, you wrote: Am 25.10.2011 05:45, schrieb mos: At 05:31 PM 10/24/2011, Reindl Harald wrote: Am 24.10.2011 23:31, schrieb mos: At 11:32 AM 10/24/2011, Reindl Harald wrote: Am 24.10.2011 18:02, schrieb mos: At 10:34 AM 10/24/2011, you wrote: select id from

large temp files created by mysql

2011-10-24 Thread Joey L
I have a very large table - approx 3 or 4 gig in size. When i initiate a process on my webpage - mysql starts to create a temporary table in /tmp directory. Is there a way i can create this file/table ahead of time so mysql does not have to create it ? thanks mjh -- MySQL General Mailing List

Re: large temp files created by mysql

2011-10-24 Thread Joey L
On Mon, Oct 24, 2011 at 10:52 AM, Joey L mjh2...@gmail.com wrote: I have a very large table - approx 3 or 4 gig in size. When i initiate a process on my webpage - mysql starts to create a temporary table in /tmp directory. Is there a way i can create this file/table ahead of time so mysql

Re: large temp files created by mysql

2011-10-24 Thread Antony T Curtis
Something you're doing is creating a very large temporary table as part of handling it's query. Usual culprit would be something doing a full table join combined with an order by or group by which would typically cause MySQL to need to create a temp table. You should do EXPLAINs on your

Re: large temp files created by mysql

2011-10-24 Thread Reindl Harald
select id from table order by rand() limit 1; is doing as example a dumb temporary table with the full size Am 24.10.2011 17:03, schrieb Joey L: On Mon, Oct 24, 2011 at 10:52 AM, Joey L mjh2...@gmail.com wrote: I have a very large table - approx 3 or 4 gig in size. When i initiate a process

Re: large temp files created by mysql

2011-10-24 Thread mos
At 10:34 AM 10/24/2011, you wrote: select id from table order by rand() limit 1; is doing as example a dumb temporary table with the full size Because it has to sort the entire table, then it returns the one row. This of course is extremely inefficient. :) You need to choose a random row by

Re: large temp files created by mysql

2011-10-24 Thread Joey L
You should do EXPLAINs on your slow-running queries to find out which ones are likely... If it is generating a 30gig file, I'd expect it must be a very slow query. I know why the files are being created - but is there anything i can do on the server to accomodate for large file operations ?

Re: large temp files created by mysql

2011-10-24 Thread Joey L
MySQLTuner 1.2.0 - Major Hayden ma...@mhtx.net Bug reports, feature requests, and downloads at http://mysqltuner.com/ Run with '--help' for additional options and output filtering Please enter your MySQL administrative login: root Please enter your MySQL administrative password:

Re: large temp files created by mysql

2011-10-24 Thread Reindl Harald
Am 24.10.2011 18:02, schrieb mos: At 10:34 AM 10/24/2011, you wrote: select id from table order by rand() limit 1; is doing as example a dumb temporary table with the full size Because it has to sort the entire table, then it returns the one row. This of course is extremely inefficient.

Re: large temp files created by mysql

2011-10-24 Thread Reindl Harald
Am 24.10.2011 18:27, schrieb Joey L: Performance Metrics - [--] Up for: 10s (2K q [237.300 qps], 591 conn, TX: 947K, RX: 261K) [!!] Key buffer size / total MyISAM indexes: 2.0G/12.0G [!!] Key buffer hit rate: 89.9% (5K cached / 524

Re: large temp files created by mysql

2011-10-24 Thread Johan De Meersman
- Original Message - From: Joey L mjh2...@gmail.com I know why the files are being created - but is there anything i can do on the server to accomodate for large file operations ? *We* don't, however :-) If you'd care to enlighten us as to the particular job and why [you believe

Re: large temp files created by mysql

2011-10-24 Thread mos
At 11:32 AM 10/24/2011, Reindl Harald wrote: Am 24.10.2011 18:02, schrieb mos: At 10:34 AM 10/24/2011, you wrote: select id from table order by rand() limit 1; is doing as example a dumb temporary table with the full size Because it has to sort the entire table, then it returns the one

Re: large temp files created by mysql

2011-10-24 Thread Reindl Harald
Am 24.10.2011 23:31, schrieb mos: At 11:32 AM 10/24/2011, Reindl Harald wrote: Am 24.10.2011 18:02, schrieb mos: At 10:34 AM 10/24/2011, you wrote: select id from table order by rand() limit 1; is doing as example a dumb temporary table with the full size Because it has to sort

Re: large temp files created by mysql

2011-10-24 Thread mos
At 05:31 PM 10/24/2011, Reindl Harald wrote: Am 24.10.2011 23:31, schrieb mos: At 11:32 AM 10/24/2011, Reindl Harald wrote: Am 24.10.2011 18:02, schrieb mos: At 10:34 AM 10/24/2011, you wrote: select id from table order by rand() limit 1; is doing as example a dumb temporary table