At 15:47 30/06/2005, Steve O'Hara wrote:
Some databases do actually allow you to maintain an insertion order.
They do this for performance reasons so that the high cost of sorting is
avoided - we have a few newspaper databases (>30 million full text stories)
that have their primary key defined as the inverse story insertion date -
this means that when a journalist searches for a story, they always get the
results in 'latest first' order, which is nearly always what they want.
Hmm, that just means that the database is storing the data in the order of
the primary key.
Note that *I* wouldn't rely on an unordered search doing returning data in
order of primary key - it sounds like a maintenance nightmare when that
behaviour changes in the underlying DB.
I'd always do a 'order by <primary key>' in the query. The database should
optimise that out if that's how it normally returns data anyway, but then,
if the underlying behaviour changes, then it would still work correctly, if
marginally slower (any DB should always be able to order by an index
(especially the primary key index) very quickly anyway)
Paul VPOP3 - Internet Email Server/Gateway
[EMAIL PROTECTED] http://www.pscs.co.uk/