MySQL very slow under Windows 8

Problems with the Windows version of XAMPP, questions, comments, and anything related.

MySQL very slow under Windows 8

Postby amln » 28. June 2013 15:34

I've recently upgraded from a Levovo X200 (Vista Ultimate 64 bit) to a Sony VAIO S15 (Windows 8 64 bit). The new notebook uses a processor which on paper is five times faster than the one in the old one.

The problem however is that MySQL is dead slow on the VAIO notebook under Windows 8. I have a routine which generates 24000 entries in a database, using the mysql_query PHP function. This routine took less than 50 seconds on the X200 under Vista 64, but now takes 1000-1200 seconds on the VAIO.

Initially I installed version 1.8.1 on the VAIO, then went back to version 1.7.7, but it didn't help. I also tried replacing "localhost" in the URL with "127.0.0.1" and it also didn't help.

Essentially it's the function mysql_query which, when called, takes 30-70 milliseconds to complete it's activities.

Looking at the task manager it appears that the hard disk (a 1TB HDD) is loaded at 100% while the processor is loaded with a few %. The HDD seems to be the limiting factor, but I have no idea why MySQL needs to access the HDD so much, given that the VAIO S15 has 12GB of RAM (the entire database would probably fit into max. 10-20MB of RAM). The old notebook with its slow processor and 8GB of RAM was much faster.

I wonder what could be done. Is there perhaps a way to tell MySQL to keep everything in RAM until the routine finishes the creation of the database and only after that write to the HDD?
amln
 
Posts: 2
Joined: 28. June 2013 14:47
XAMPP Version: 5.6.3
Operating System: Windows 8

Re: MySQL very slow under Windows 8

Postby hackattack142 » 28. June 2013 21:48

Hello,

I suggest you give this page a read: http://dev.mysql.com/doc/refman/5.5/en/commit.html
XAMPP Control Panel Developer
Latest CP: viewtopic.php?f=16&t=48932
hackattack142
 
Posts: 703
Joined: 20. May 2011 23:29
XAMPP Version: 5.6.3
Operating System: Windows 7 Ultimate SP1 64-Bit

Re: MySQL very slow under Windows 8

Postby amln » 28. June 2013 22:59

Impressive - that was the solution:

// before the loop:
mysql_query("START TRANSACTION;", $db);

// then the database loop over the 24000 entries

mysql_query("COMMIT;", $db);
mysql_close($db);

Reduced the execution time from 1200 seconds to 15 seconds.

BTW, what is this set of mysqli_* functions? Are they better than mysql_* functions?
amln
 
Posts: 2
Joined: 28. June 2013 14:47
XAMPP Version: 5.6.3
Operating System: Windows 8

Re: MySQL very slow under Windows 8

Postby Altrea » 28. June 2013 23:29

The mysql_ functions are tagged as deprecated since PHP 5.5 and will be removed completely from PHP core with one of the next major releases (PHP 5.6 or PHP 6) so you should take some time to read something about the alternatives mysqli and pdo

I prefer PDO because it is full OOP and does have multiple database adapters.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 6762
Joined: 17. August 2009 13:05
XAMPP Version: 5.5.19
Operating System: W7Ux64

Re: MySQL very slow under Windows 8

Postby ronnelson » 14. July 2013 18:12

I changed my reference to 127.0.0.1 from localhost in the $sqlhost variable for the mysql_connect command in the code opening my connection to MySQL database. DRAMATIC DIFFERENCE is the time my pages (which all use MySQL) load.

<?PHP
$sqlhost="127.0.0.1"; <----- This used to say "localhost"
$sqluser="xxxx";
$sqlpassword="ppppppp";
$sqldatabase="dbdbdbdb";
$sqlconnection=mysql_connect($sqlhost,$sqluser,$sqlpassword)
or die ("Couldn't connect to SqlServer");
ronnelson
 
Posts: 1
Joined: 14. July 2013 18:06
XAMPP Version: 5.6.3
Operating System: Winodws 8

Re: MySQL very slow under Windows 8

Postby irosas » 08. November 2013 15:46

I suspect strongly that changing the value of the $sqlhost variable is the answer I need to solve my problem which is that both localhost AND 127.0.0.1 are loading super slow (I mean like 10 seconds to load). However, I don't know where to find that $sqlhost variable... I have xampp 1.8.1 and Windows 7 and my websites are joomla 2.5 and joomla 3.1 websites. Can someone pinpoint the path/file that must be edited? Thanks!!
irosas
 
Posts: 1
Joined: 08. November 2013 15:41
XAMPP Version: 1.8.2-4
Operating System: Windows 7

Re: MySQL very slow under Windows 8

Postby Nobbie » 08. November 2013 17:28

irosas wrote:Can someone pinpoint the path/file that must be edited? Thanks!!


This is a question for a Joomla forum as it is an issue from Joomla.
Nobbie
 
Posts: 6919
Joined: 09. March 2008 13:04


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 38 guests