Documentum/DQL: Default sort order in search results of dql

If I ran a select DQL statement and there is no ORDER BY clause included, what is the default sort order for basic search?

Trace the query in the database - if there is no order by then the database is free to return the records in any order it wants, the actual order will be driven by query plans and the order in which data is stored in the blocks.
If you wish your data to be returned in a particular order you must include an ORDER BY clause.


Another EMC Solution for reference:
Default sorting of search results in TaskSpace

Symptoms

Two consecutive executions of a Search query return sets with different order of results


Cause

In the DB side, the retrieved data is not displayed in a mere random order. If unsorted, data will typically be displayed in the order in which it appears in the underlying tables. This could be the order in which the data was added to the tables initially.
But, if data was subsequently updated or deleted, the order will be affected by how the DBMS reuses reclaimed storage space. The end result is that you cannot (and should not) rely on the sort order if you do not explicitly control it. Relational database design theory states that the sequence of retrieved data cannot be assumed to have significance if ordering was not explicitly specified.

Resolution

In order to control sorting of the Search results, a dql query used in a Search template should be modified by adding an ORDER BY statement (i.e. ORDER BY r_object_id). It will explicitly set the sorting of the result set and help to avoid inconsistent sorting of consecutive results.

猜你喜欢

转载自vasile.iteye.com/blog/1118623
DQL