You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Øystein Grøvlen <Oy...@Sun.COM> on 2005/08/01 12:46:18 UTC

Re: Natural Sort Order

>>>>> "JR" == Justin Rudd <ju...@gmail.com> writes:

    JR> SELECT id, enqueued_datetime, begin_dequeue_datetime, content FROM
    JR> messages WHERE release_datetime < ? and begin_dequeue_datetime = 0 FOR
    JR> UPDATE begin_dequeue_datetime

    JR> Where the first '?' in the select is the time which the query came in
    JR> (System.currentTimeMillis()).

    JR> It uses the IxMsgsRel index, but the ordering doesn't appear to use
    JR> that index.  The query log doesn't show me what it is using for
    JR> sortation.  I would have expected the sortation order to be
    JR> release_datetime and then enqueued_datetime.  It wouldn't be strict
    JR> fifo, but it would be close enough.

    JR> So how do I tell what Derby is using for sortation?

If you want a specific ordering, you should add an "ORDER BY" clause
to your statement.

-- 
Øystein