I have a php script which updates the Mysql Database. I've been having major problems as the process takes 10-20 mins to update 5k records on the live webserver. Locally, it takes 0.5 second. In desperation, I tried using just one Insert query, which worked well for the first 250 rows and then failed. I was able to tweak my home Mysql config, but I can't change the config of the live web server. I'm using Indexes on my tables; one Primary on my id field, and a couple of other Indexes (code below).
I have the same script (with Indexes)running here: and it takes 5-10 seconds! So I was assuming it was a hosting issue, but I ran the same script on the problem server without the Indexes, and it took just 10 seconds. The hosting company are not that willing to help.
So what's the answer? Does my code need a re-think or is it a hosting issue?
I have the same script (with Indexes)running here: and it takes 5-10 seconds! So I was assuming it was a hosting issue, but I ran the same script on the problem server without the Indexes, and it took just 10 seconds. The hosting company are not that willing to help.
So what's the answer? Does my code need a re-think or is it a hosting issue?
Code:
// add a table to the selected database
$result="CREATE TABLE accessories (
id int(5) NOT NULL,
catno varchar(255) NOT NULL,
family varchar(255) NOT NULL,
section varchar(255) NOT NULL,
header varchar(255) NOT NULL,
category varchar(255) NOT NULL,
description varchar(255) NOT NULL,
addinfo varchar(255) NOT NULL,
stocklevel int(5) NOT NULL,
vrate FLOAT(10) NOT NULL,
single varchar(10) NOT NULL,
picture varchar(40) NOT NULL,
post int(5) NOT NULL,
uqty varchar(10) NOT NULL,
unit varchar(50) NOT NULL,
price FLOAT(10) NOT NULL,
vat FLOAT(10) NOT NULL,
KEY id (id), KEY catno (catno), KEY section (section), KEY description (description), KEY category (category), KEY header (header)) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
mysql_query("INSERT INTO accessories VALUES ('0', 'AA10L', 'group', 'Accessories', 'Monkey', 'Nuts', 'Brown and hairy', '', '28', '0.15', 'Pack of 6', 'no_image.jpg', '0', '1', 'Pack of 6', '4.16', '0.62')");
mysql_query("INSERT INTO accessories VALUES ('1', 'AA10S', 'group', 'Accessories', 'Cat', 'Cat Food', 'Comes in a tin', 'Comes in a tin', '74', '0.15', 'Pack of 6', 'aa10s.jpg', '0', '1', 'Pack of 6', '4.13', '0.62')");
[/code/
Any ideas