slow mysql database
Posted by: Torsten Mueller
Date: April 23, 2013 06:24AM

Hi,
i have a data base wich will have 500000 lines.
At the moment it have 190000 lines and it's so very slow...
Here is the structure:
CREATE TABLE `produkte` (
`nummer` int(11) NOT NULL AUTO_INCREMENT,
`anbieter` text NOT NULL,
`ueberschrift` text NOT NULL,
`beschreibung` text NOT NULL,
`bildlink` text NOT NULL,
`shoplink` text NOT NULL,
`preis` float NOT NULL,
`marke` text NOT NULL,
`kat1` text NOT NULL,
`kat2` text NOT NULL,
`kat3` text NOT NULL,
`kat4` text NOT NULL,
PRIMARY KEY (`nummer`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=193560 ;

I have to search the kat elements. So i made the following PHP order:

$sql="SELECT distinct kat4 FROM produkte WHERE kat1='".$_SESSION['kat1']."' AND kat2='".$_SESSION['kat2']."' AND kat3='".$_SESSION['kat3']."'";
$res=mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($res)!=0){
$sql="SELECT distinct kat4 FROM produkte WHERE kat1='".$_SESSION['kat1']."' AND kat2='".$_SESSION['kat2']."' AND kat3='".$_SESSION['kat3']."'";
$res=mysql_query($sql) or die(mysql_error());
...
And here i fill the option element in a while loop.

This i make for 4 select elements.
So the script needs more than 12 seconds. It's to slow.
How can i make it's faster?

Thanx for help.

Best regards.
Torsten

Options: ReplyQuote


Subject
Written By
Posted
slow mysql database
April 23, 2013 06:24AM
April 23, 2013 10:15AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.