Home » Performance » MySQL » Temporary Tables - Under the hood
Temporary Tables - Under the hood [message #1244] Sat, 12 May 2007 15:45
carpii  is currently offline carpii
Messages: 46
Registered: November 2006
Member
Can anyone please explain to me what actually happens when a temporary table is created.

I understand it does not necessarily mean the table is being created on disk.

Ill give an example to help you explain

Table A (a_id int Primary key, a_field1 int, a_field2 int)
Table B (b_id int Primary key, b_field1 TEXT, b_field2 TEXT)

If I join A and B (via select *), and a temp table is being created, what is actually being copied?
Is it just the keys (a_id and b_id), or is the TEXT also being copied?

Now what if I join A and B (but only select a_id and b_id). Again EXPLAIN shows a temp table being used.
Is the temp table any different?

Thanks for any advice. This is only a trivial example I made up, but the results could affect my database design a lot.

[Updated on: Sat, 12 May 2007 15:45]

Previous Topic:Transaction Wrapper
Next Topic:Server statistics - COM_SET_OPTION
Goto Forum:
  



Current Time: Tue Jan 6 07:07:42 EST 2009

Total time taken to generate the page: 0.03799 seconds
.:: Contact :: Home :: MySQL Support by Percona.com ::.

Powered by: FUDforum 2.7.5.
Copyright ©2001-2006 FUD Forum Bulletin Board Software

MySQL Performance | Forum authority Badge