Ask a Question related to MySQL, Design and Development.
-
Ted #1
Trouble creating temporary memory table
I tried to create a temporary memory table using the following:
CREATE TEMPORARY TABLE mytable_tmp LIKE mytable ENGINE=MEMORY;
However, I encountered a problem in that MySQL didn't like this
statement with the clause "ENGINE=MEMORY". If I remove this clause,
all is fine. However, I wanted the temporary table to be a memory
table, though, for the sake of speed. I suspect I may have to process
some of the data before moving it to its final destination.
The statement above clearly shows what I want to do at this stage. Can
I do it this way, or do I have to extract the SQL statement that would
create the table and alter it to use the memory engine?
Thanks,
Ted
Ted Guest
-
Temporary Table Creation Problem in CF7 not CF6.1
We have been preparing for our upgrade to CF7.0 from 6.1 on a test site with a test mssql database and come across an issue we cannot resolve. Maybe... -
Get result from temporary Oracle Table
Hi, Having problem with temporary table from Oracle. Runing my stored procedure (which stores an amount of row in a temporary table) from an Sql... -
#26387 [NEW]: TABLE TEMPORARY DOES NOT WORK
From: davefazio at annulet dot com Operating system: Windows 2003 Sever PHP version: 5.0.0b2 (beta2) PHP Bug Type: MySQL... -
Temporary Table Query
Hi, I am inserting data into a temporary table using the following method: select a into #b from c This method works fine, but...if i... -
Is there any equivalent of Sql Server's temporary table in Oracle
On Thu, 05 Dec 2002, gamaz@eathlink.net wrote: Let Oracle do the temporary set building. You code the join. -- Galen Boyer -
Bill Karwin #2
Re: Trouble creating temporary memory table
Ted wrote:
[url]http://dev.mysql.com/doc/refman/4.1/en/memory-storage-engine.html[/url] says:> I tried to create a temporary memory table using the following:
>
> CREATE TEMPORARY TABLE mytable_tmp LIKE mytable ENGINE=MEMORY;
"Before MySQL 4.1, MEMORY tables are called HEAP tables."
So if you are using MySQL 4.0 or earlier, try ENGINE=HEAP.
If you are using MySQL earlier than 4.0, try TYPE=HEAP.
Regards,
Bill K.
Bill Karwin Guest
-
Ted #3
Re: Trouble creating temporary memory table
OOPS!
I should havr said I am using MySQL 5.0.16
Thanks.
Ted
Ted Guest
-
Bill Karwin #4
Re: Trouble creating temporary memory table
Ted wrote:
> I should havr said I am using MySQL 5.0.16
>
> CREATE TEMPORARY TABLE mytable_tmp LIKE mytable ENGINE=MEMORY;
Aha -- [url]http://dev.mysql.com/doc/refman/5.0/en/create-table.html[/url] says:
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
[(create_definition,...)]
[table_options] [select_statement]
Or:
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
[(] LIKE old_tbl_name [)];
This suggests that using table_options (of which ENGINE=MEMORY is an
example) is not permitted when you're using LIKE old_tbl_name.
So perhaps it would work to use "show create table mytable", get a full
CREATE TABLE statement, and then edit that to specify the MEMORY engine
option.
Regards,
Bill K.
Bill Karwin Guest
-
Ted #5
Re: Trouble creating temporary memory table
Thanks Bill,
OK, as expected, that works after a fashion.
Something annoying I am seeing, though, is that I have several columns
which are of type char, intended to hold 'y' or 'n'. Had I had control
over the format, these would be boolean. However, I must work with
what I get. The problem is that either MySQL or MySQL Query Browser is
converting char into tinyint. I wouldn't care about this except that
when the data is to be loaded into the table, I get an error message
basically saying that 'y' and 'n' are not valid numbers. Every time I
view the table definition, I see the fields stored as tinyint. I
change them to char, and all is ok until the next time I look, and then
I see them converted back to tinyint.
Thanks,
Ted
Ted Guest
-
Bill Karwin #6
Re: Trouble creating temporary memory table
Ted wrote:
Is this only happening with your ENGINE=MEMORY table? I haven't worked> view the table definition, I see the fields stored as tinyint. I
> change them to char, and all is ok until the next time I look, and then
> I see them converted back to tinyint.
with such tables, perhaps they don't take kindly to being altered. What
about dropping the table and recreating it with the column defined as CHAR?
Regards,
Bill K.
Bill Karwin Guest
-
Ted #7
Re: Trouble creating temporary memory table
No, this is happening with all of my InnoDB tables, even those created
de novo.
Cheers,
Ted
Ted Guest
-
Jerry Stuckle #8
Re: Trouble creating temporary memory table
Ted wrote:
Tinyint is a synonym for CHAR. This is by design.> Thanks Bill,
>
> OK, as expected, that works after a fashion.
>
> Something annoying I am seeing, though, is that I have several columns
> which are of type char, intended to hold 'y' or 'n'. Had I had control
> over the format, these would be boolean. However, I must work with
> what I get. The problem is that either MySQL or MySQL Query Browser is
> converting char into tinyint. I wouldn't care about this except that
> when the data is to be loaded into the table, I get an error message
> basically saying that 'y' and 'n' are not valid numbers. Every time I
> view the table definition, I see the fields stored as tinyint. I
> change them to char, and all is ok until the next time I look, and then
> I see them converted back to tinyint.
>
> Thanks,
>
> Ted
>
What does your insert statement look like?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
[email]jstucklex@attglobal.net[/email]
==================
Jerry Stuckle Guest
-
Ben Walters #9
Re: Trouble creating temporary memory table
I had a similar issue, it turns out I just needed to add the default charset at the end of the statement and include backticks around the table name and column name to get it to work properly.
It is probably of note that I was entering this information through the query window of Sequel Pro for Mac OS X and not the mysql console.
My statement started as :
CREATE TEMPORARY TABLE IF NOT EXISTS tmplog (msg varchar(512)) ENGINE = MEMORY;
and it finally worked when I changed it to:
CREATE TEMPORARY TABLE IF NOT EXISTS `tmplog` (`msg` varchar(512)) ENGINE=Memory DEFAULT CHARSET=latin1;
Junior Member
- Join Date
- Jan 2011
- Posts
- 1



Reply With Quote

