Thanks Frank.
I sorted the db originally as an experiment, but know not to do this now.
I'm learning slowly, well I am 59.

I've got logged as PRIMARY KEY (`logged`)
and to display all the records, I use:

SELECT *, UNIX_TIMESTAMP(logged) AS posted FROM forum ORDER BY logged DESC
Regards, Bob.


----- Original Message ----- 
From: "Mike Franks" <[EMAIL PROTECTED]>

> Bob - As Pete tried to tell you, there's really no such thing as sorting
> a retational data base (like MySQL). You can insert a set of records
> that are already sorted, but as soon as you insert even one additional
> record,  the sort order is undefined.
> 
> Instead, you perform efficient searches by creating indexes on certain
> fields.  Even indexes *can* cause performance degradation (when
> inserting or updating), so don't overdo it. However, if you will
> frequently perform queries based on the "logged" column, by all means,
> this column should be indexed.
> 
> Once the column is indexed, your initial query will actually be fastest
> in a large data base:
> 
> select *
> from table
> where ....
> order by indexed_date_column desc limit 1;
> 
> hth,
> 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