Garayed.com  

Go Back   Garayed.com > mySQL
FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-05-2007, 01:23 PM
saspijkerman
 
Posts: n/a
Default table content rebuild - "optimal" solution

In our database we want to create some cache tables for speed
purposes.

There will be no relationships in this tables.
The update script will be written in PHP
It takes a while to select all the values for these tables from
several other highly populated tables.

My idea is to create a temp table, build it from a DESC command from
the original table, fill it, remove the old table by the DROP TABLE
command and rename the temp table to the original name with the RENAME
TABLE command

Does anyone have experience with this kind of action and what do you
that that are the pro's and con's?

I think that speed is one of the biggest pro's

Thanks for thinking with me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 12-05-2007, 01:37 PM
Peter H. Coffin
 
Posts: n/a
Default Re: table content rebuild - "optimal" solution

On Wed, 5 Dec 2007 06:23:22 -0800 (PST), saspijkerman wrote:
> In our database we want to create some cache tables for speed
> purposes.
>
> There will be no relationships in this tables.
> The update script will be written in PHP
> It takes a while to select all the values for these tables from
> several other highly populated tables.
>
> My idea is to create a temp table, build it from a DESC command from
> the original table, fill it, remove the old table by the DROP TABLE
> command and rename the temp table to the original name with the RENAME
> TABLE command
>
> Does anyone have experience with this kind of action and what do you
> that that are the pro's and con's?


RENAME TABLE old_table TO backup_table, new_table TO old_table;

then worry about DROPping the backup_table. Then there will never be a
point at which old_table (the one everything accesses) doesn't exist.

--
58. If it becomes necessary to escape, I will never stop to pose dramatically
and toss off a one-liner.
--Peter Anspach's list of things to do as an Evil Overlord
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 08:53 PM.




LinkBacks Enabled by vBSEO 3.0.0 © 2007, Crawlability, Inc.