MySQL Forums
Forum List  »  Performance

Re: [REAL] TABLE vs TEMPORARY TABLE
Posted by: Rick James
Date: December 03, 2009 11:26PM

How did you create the indexes on the 4 tmp tables? Recommend:
CREATE TEMPORARY TABLE t (
   PRIMARY KEY (joinkey)
) SELECT ...;

InnoDB or MyISAM? (It could make a big difference.) It can be controlled thus:
CREATE TEMPORARY TABLE t (
   PRIMARY KEY (joinkey)
) ENGINE=InnoDB
SELECT ...  ORDER BY joinkey;
(No, InnoDB won't necessarily be better.)

I think you can get by without any indexes on TTtable2. (This might save some time in building that table.)

To assist in analyzing slow SELECTs, please provide
* SHOW CREATE TABLE tbl\G -- engine, indexes
* SHOW TABLE STATUS LIKE 'tbl'\G -- sizes
* EXPLAIN SELECT ...\G -- clues of inefficiencies
* SHOW VARIABLES LIKE '%buffer%'; -- cache size
and surround them with [ code ] and [ / code ]

Options: ReplyQuote


Subject
Views
Written By
Posted
2606
December 02, 2009 01:22PM
Re: [REAL] TABLE vs TEMPORARY TABLE
1295
December 03, 2009 11:26PM


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.