[PHP] Time difference desired load

2009-04-20 Thread admin
Suggestion on faster solutions for extremely large database.

$ledip['started'] = '2009-04-01 13:40:34'; Example time in DB
$ledip['touchedlast'] = '2009-04-01 13:41:28'; Example time in DB


date('i:s', strtotime($ledip['touchedlast']) - strtotime($ledip['started'])); 
// Not a desired solution because of its inability to go past the minute 
correctly I AM AWARE.


or 

concat( truncate( hour( timediff($ledip['touchedlast'],$ledip['started']) ) 
/24, 0 ) ,  days , hour( timediff($ledip['touchedlast'],$ledip['started']) ) 
%24,  hours , minute( timediff($ledip['touchedlast'],$ledip['started'] ) ) , 
 minutes , second( timediff($ledip['touchedlast'],$ledip['started'] ) ) ,  
seconds ) as timeleft


The results of concat truncate, allows me the flexibility or exacting time 
differences out past the minute. I am worried that the vastness of the database 
may cause me a server load or query timeframes that are undesirable as it grows 
even bigger.
Suggestions?

*   PLEASE 
Do not reply to this email with your 9 million page thought of how to,  or some 
custom function that you think is all that, I do not care.
I am asking for load desired results NOT your take on my code…

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Time difference desired load

2009-04-20 Thread Bastien Koert
On Mon, Apr 20, 2009 at 1:38 PM, ad...@buskirkgraphics.com wrote:

 Suggestion on faster solutions for extremely large database.

 $ledip['started'] = '2009-04-01 13:40:34'; Example time in DB
 $ledip['touchedlast'] = '2009-04-01 13:41:28'; Example time in DB


 date('i:s', strtotime($ledip['touchedlast']) -
 strtotime($ledip['started'])); // Not a desired solution because of its
 inability to go past the minute correctly I AM AWARE.


 or

 concat( truncate( hour( timediff($ledip['touchedlast'],$ledip['started']) )
 /24, 0 ) ,  days , hour( timediff($ledip['touchedlast'],$ledip['started'])
 ) %24,  hours , minute( timediff($ledip['touchedlast'],$ledip['started'] )
 ) ,  minutes , second( timediff($ledip['touchedlast'],$ledip['started'] )
 ) ,  seconds ) as timeleft


 The results of concat truncate, allows me the flexibility or exacting time
 differences out past the minute. I am worried that the vastness of the
 database may cause me a server load or query timeframes that are undesirable
 as it grows even bigger.
 Suggestions?

 *   PLEASE 
 Do not reply to this email with your 9 million page thought of how to,  or
 some custom function that you think is all that, I do not care.
 I am asking for load desired results NOT your take on my code…

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


You are doing a lot of calculation on this combining both PHP and SQL code.
How many rows are you affecting with this query at one time?

I hate to say it, but this to me is just begging for a unix timestamps, then
you can simply deal with the seconds remaining on this counter.

-- 

Bastien

Cat, the other other white meat