Re: [PHP] mysql_connect slowness
- From: joe@xxxxxxxxxxxxxxxxxx ("Joe Harman")
- Date: Tue, 29 Apr 2008 14:25:45 -0500
Hi Waynn!
have you ever tried using
1. sql_cache
SELECT SQL_CACHE * FROM table ......
I use this alot... although you have to have mysql cache enable in the
sql config file... your webhost can tell you if it is on or not
2. make indexes for your tables
here is a good article
http://www.databasejournal.com/features/mysql/article.php/1382791
a great admin program to use is Navicat... it's very easy to make your
indexes there...
Hopefully those 2 suggestions speed up things a little! :o) let us
know if it works
Joe
On Mon, Apr 28, 2008 at 12:14 AM, Waynn Lue <waynnlue@xxxxxxxxx> wrote:
Our site has been slowing down dramatically in the last few days, so.
I've been trying to figure out why. I ran some profiling scripts on
our site and saw that we're spending between 3-9 seconds on
mysql_connect. Then I connected to our db and saw that there were
over 100 connections at the time, most of them sleeping. Is this
because we don't close mysql connections until the end of script
execution?
How do people generally structure their code to minimize the time they
keep mysql connections open? Currently all db connections go through
one file, which gets included at the top of the file. One other
question, is it better to open one connection, then re-use it later,
or just continually open and close per db call?
Thanks,
Waynn
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
- References:
- mysql_connect slowness
- From: "Waynn Lue"
- mysql_connect slowness
- Prev by Date: Help with preg_match_all regex for alt tags
- Next by Date: Re: [PHP] Help with preg_match_all regex for alt tags
- Previous by thread: Re: [PHP] mysql_connect slowness
- Next by thread: Re: query wildcard
- Index(es):
Relevant Pages
|