This is using version: 5.0.18-log on linux.
I have a stored procedure that takes .2 sec the first time,
12 the second, 12 the third.  The data is unchanged.  
The relevant part of the procedure looks like this.

 ...
 drop temporary table if exists temptab;
 create temporary table temptab (index (id))
  (SELECT id, col1, ... FROM table1);
 set @sql = concat("SELECT ", cols, -- cols is an input string
                   " FROM table2 LEFT JOIN table3 on
                      table2.id = table3.col2
                     left join temptab
                     ON temptab.id=table3.col3
                    WHERE table2.col4=", quote(anotherinput),
                   " ORDER by col5");
 PREPARE stmt FROM @sql;
 EXECUTE stmt;
 DEALLOCATE PREPARE stmt;

I doubt that the exact form of the query makes much difference.
In fact, the same thing happens with two different queries I
tried, but both using a temporary table built just before the 
query.  That was intended to improve performance - and did the
first time.

It's not that dropping and creating the table is expensive.
I can do that over and over again in approximately 0 sec.

Any ideas?

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to