Search:  

 
 
   All ForumsHot TopicsGallery






how-to block ads


 
Forums » Tech and Talk » OS and Software » Webmasters and Developers » php - insert result set to different table
Uniqs:
443
Share Topic:
RSS topic:
toggle:
flat / full
normal / watch
Posting:
Post a:
Post a:
Average Salaries of I.T. Professionals »
« uploading data to SQL Server 2005 timeout issues  

Dersgniw
Disco Crunchin
Premium,MVM
join:2001-08-10
behind you
clubs:
·Optimum Online


1 edit

php - insert result set to different table

I have 2 tables, in 2 databases.

I want to select data from table AA (on DB 1), then insert that to a temporary table B (on DB 2). Since they are in different DB's, is there an easy way to do this? I'm talking 10,000-20,000 rows so I'm just looking for some efficiency.
--
I Smell Cures! -- Our Hope

GILXA1226
Premium,MVM
join:2000-12-29
London, OH
clubs:

Re: php - insert result set to different table

What are you using for a database engine?

Dersgniw
Disco Crunchin
Premium,MVM
join:2001-08-10
behind you
clubs:
·Optimum Online

Re: php - insert result set to different table

said by GILXA1226 See Profile :

What are you using for a database engine?
MySql
--
I Smell Cures! -- Our Hope

yock
TFTC
Premium
join:2000-11-21
Fairfield, OH

Re: php - insert result set to different table

MyISAM or InnoDB?

Dersgniw
Disco Crunchin
Premium,MVM
join:2001-08-10
behind you
clubs:

Re: php - insert result set to different table

MyISAM

yock
TFTC
Premium
join:2000-11-21
Fairfield, OH


1 edit

Re: php - insert result set to different table

MySQL supports bulk inserts by simply passing multiple data sets to the VALUES directive, like so:

You'll need to pay attention to the value of one of two PHP configuration variables too. The variable 'upload_max_size' governs how much data PHP can send directly to a host, while 'post_max_size' governs how much data PHP will allow you to send via HTTP $_POST. If you're using HTTP to send this you'll want the latter, if you're connecting directly to the MySQL server then you want the fomer.

MySQL also has limits on how much data it can receive. If your inserts are failing and PHP isn't kicking back any errors, try increasing MySQL's 'max_allowed_packet'. You can do this via command line by issuing the command:

mysql --max_allowed_packet=24M

Where "24M" is the size in megabytes of the desired value.

One final note. Though MyISAM doesn't support foreign keys, it does support unique indexes. I'm not entirely sure this will help with MyISAM (it's listed as a performance consideration for InnoDB with bulk inserts) but disabling unique checks should speed you up too if you already know that the data folows your uniqueness rules.

To disable that, login to mysql in the command line and issue the following command:

SET unique_checks=0;

I hope this helps you get started.

yock
TFTC
Premium
join:2000-11-21
Fairfield, OH

Re: php - insert result set to different table

I should note too that the MySQL information in this post is for MySQL 5.1. If you're using a 4.x or 6.0 MySQL server, you may need to check on the variable names.
Forums » Tech and Talk » OS and Software » Webmasters and DevelopersAverage Salaries of I.T. Professionals »
« uploading data to SQL Server 2005 timeout issues  


Thursday, 10-Dec 01:33:30 Terms of Use | Privacy Policy | Hosting by www.nac.net - DSL,Hosting & Co-lo | feedback | contact
over 10 years online! © 1999-2009 dslreports.com.republican-creole
page compression OFF
Most commented news this week
· [200] Sprint Sued For Distracted Driving Death
· [109] AT&T Launching New 24 Mbps U-Verse Tier
· [82] 3G Network Test Says AT&T Is Tops
· [72] Mediacom Unveils 105 Mbps Pricing
· [66] Sprint Poised For A Turnaround?
· [66] WPA Cracker: Test WPA-PSK Networks In 20 Minutes
· [66] AT&T Hints At Usage-Based iPhone Data Pricing
· [51] The Future Of Wi-Fi Is Bright
· [47] Site Leaks Yahoo, Verizon Fed Data Share Pricing
· [45] Microwaving Your Innards Is Not 'Extreme'
Most people now reading
· Windows 7 boot manager editing questions [Microsoft Help]
· Hot Girl falls face first down stairs [56k Lookout (Broadband Heavy)]
· Cross Server Dungeon Experience [World of Warcraft]
· Official "Invite" thread Part 3 - ALL INVITES GO HERE ! [Filesharing Software]
· 3.x Feral Druid - Bear Tanking Guide [World of Warcraft]
· ICC strats [World of Warcraft]
· ICC Strats??? [World of Warcraft]
· [ Classes] Druid tanking: rotation and glyphs [World of Warcraft]
· MagicJack Error Broken Storage [MagicJack]
· ToC 4th boss - Preliminary Strategy for Twin Valkyr [World of Warcraft]