On 6/20/2005, "Bob" <[EMAIL PROTECTED]> wrote:

>Hi Pete,
>Just thought I'd let you know that I used "Giztimer" (it's just a ready made 
>class timer which you can start and stop etc.) to test the 2 options.
>
>$result = mysql_query("SELECT UNIX_TIMESTAMP(MAX(logged)) AS logged FROM 
>forum");
>$result = mysql_query("SELECT UNIX_TIMESTAMP(logged) AS logged FROM forum 
>ORDER BY logged DESC LIMIT 1");
>

Bob - this is not the query you originally said you wanted to perform.
Originally, you wanted the entire record for the latest transaction.
That is:

"SELECT *, UNIX_TIMESTAMP(logged) AS logged FROM forum ORDER BY logged
DESC LIMIT 1"

- or -

"SELECT *, UNIX_TIMESTAMP(logged) AS logged FROM forum WHERE logged =
MAX(logged)"

I'd be very interested in seeing the performance results of these two
queries, and suspect they'll be very similar in a table with less than
1000 records, with or without an index on the 'logged' column.

It would be REALLY interesting to see the results on a table with 100,000
records! <g>

Regards,
Mike


Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to