MySQL insert query takes ages (strange thing that has disappeared)
| From: | Cynic | Date: | Mon, 17 Apr 2000 19:20:01 +0000 |
| Subject: | MySQL insert query takes ages (strange thing that has disappeared) | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-13637@lists.php.net to get a copy of this message | ||
Not a real problem, but outta curiosity:
my setup:
NT4 SP5 WKS, MySQL 3.23.10-alpha, PHP4 RC2-dev snapshots before 15/04 12:45
(did the same with RC1), Apache 1.3.11
PII 450 256MB RAM, HDD: WD (nothing special)
heavily used workstation
I host a site for a friend of mine on my computer. All pages it consists
of have this at the top:
<?
require( "$DOCUMENT_ROOT/e2/inc/include.inc" ) ;
http_info_store() ;
?>
include.inc contains among other things this:
$http_info = array( "ip"=>$REMOTE_ADDR , "via"=>$HTTP_VIA ,
"uri"=>$REQUEST_URI , "ref"=>$HTTP_REFERER ,
"ua"=>$HTTP_USER_AGENT ) ;
function sql_conn()
{
mysql_connect( 'localhost' , 'user' , 'pwd' ) or die(
'Connection to SQL server failed.' ) ;
mysql_select_db( 'e2' ) or die ( 'Database connection failed.' ) ;
} ;
function http_info_store()
{
global $http_info ;
sql_conn() ;
mysql_query( "insert into log ( dat , ip , via , uri , ref , ua ) values ( "
. "now(), '$http_info[ip]' , '$http_info[via]' ,
'$http_info[$uri]' , "
. "'$http_info[$ref]' , '$http_info[$ua] )" ) ;
mysql_close() ;
} ;
I'm storing this in the db (besides ususal logging) so that he can view
hits for his site in a browser. Everything worked fine, until one day it
started doing this strange thing:
it took ages to process the query when the page was hit for the first time.
I. e. I hit the link in one frame, and it took about one minute to display
the page. I clicked on the link again, and it displayed in one second. The
same with all the links in the menu.
I reloaded the frameset, and again, it took ages to display a page that was
requested for the first time. I clicked the link again, and it was here in
a second.
Today I realized the described strangeness disappeared. Dunno if it's the
snapshot (currently 15/04 12:45) or what... Any idea?
____________________________________________________________
Cynic:
A member of a group of ancient Greek philosophers who taught
that virtue constitutes happiness and that self control is
the essential part of virtue.
cynic@mail.cz
ICQ: 2808 2505