[PHP-DB] Re: major performance disparities with mysql/php - SOLVED
Nevermind.. I found the problem. My production server is running mysql 3.22.29, and I needed to use a SET SQL_BIG_TABLES=1 in many places to prevent a full table condition. The new server is running 3.23, and once I removed the SQL_BIG_TABLES=1 from the script (and allowed mysql to use memory instead), everything worked as expected. It was a PHP problem afterall - the developer! -Hank __ Do You Yahoo!? Yahoo! Movies - coverage of the 74th Academy Awards® http://movies.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Determine last quarter
If anyone is interested, this is what I finally came up with. I'm not sure how graceful it is, but it works ;) Here's another method... which can be condensed, but I left it expanded to demonstrate what was going on. The trick is finding the first day of the *next* month, and getting the previous day ( mktime(0,0,0,$start_month+3,0,$year) ), which is always the last day of the previous month. -Hank ? $quarter = ceil(date('n')/3); $last_quarter = ($quarter==1?4:$quarter-1); $year =($last_quarter==4?date(Y)-1:date(Y)); $start_month = (($last_quarter-1)*3)+1; $end_day = date(d,mktime(0,0,0,$start_month+3,0,$year)); echo Start Date:.date(Y-m-d,mktime(0,0,0,$start_month,1,$year)).\n; echo End Date:.date(Y-m-d,mktime(0,0,0,$start_month+2,$end_day,$year)).\n; ? __ Do You Yahoo!? Yahoo! Sports - live college hoops coverage http://sports.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] major performance disparities with mysql/php
Hello - I'm posted this to the mysql list but got no response. While it sounds like a mysql problem, I'm convinced that it is a PHP problem (see bottom of note.) I've recently installed mySQL on a RH7.2 box without any problems - it runs great. I've been testing some long running queries (full table scans, etc) under different scenarios, and get wildy differing results. Between each test case, I was flushing all tables and re-starting the mysql deamon. When I run one of my longest queries in the mysql command line client, it runs in about 77 seconds. When I run the identical query via a simple PHP script running on the box, the same query takes about 930 seconds to complete. For the life of me, I can not figure out why the identical query would run differently from the command line than from PHP. I've repeated this test about 10 times just to be sure - and it is entirely repeatable: command line - about a minute - PHP - about 16 times longer. Any ideas or suggestions? I'm running RH 7.2 (2.4.9-21) on a Dell Poweredge 2550, 1GB memory, RAID, with mysql version 3.23.41 (the standard install unchanged from the RH media). Here is the query...pretty simple: insert into summary_table select frb, denom, series, count(*) as cnt, sum(bills) as bills, sum(bills_hit) as bills_hit, sum(total_hits) as total_hits from detail_table If it a memory/cpu resource problem, how do I set RH to give PHP and Apache the same priority as the mysql deamon? I've also written a small Perl script to execute the same queries, and that runs in 70 seconds (same as mysql client), so there must be some memory/processor limitation placed on PHP that prevents it from running as quickly as these other methods. Any ideas/suggestions? Many thanks in advance.. -Hank __ Do You Yahoo!? Yahoo! Sports - live college hoops coverage http://sports.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php