Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: will the Return Order of rows change with time ?

RE: will the Return Order of rows change with time ?

From: Ratnesh Kumar Singh <ratnesh.singh_at_patni.com>
Date: Wed, 23 Oct 2002 00:58:39 -0800
Message-ID: <F001.004F0B0D.20021023005839@fatcity.com>


Thanks Richard

good explanation ..
Your answer has cleared all my doubts .
thanks again to all who replied to this query.

ratnesh

-----Original Message-----

Richard
Sent: Wednesday, October 23, 2002 1:14 PM To: Multiple recipients of list ORACLE-L

I understand what you are saying. Most people responded that there is no guarantee because that is the true answer. In a sense you are correct - if nothing changes the optimisers approach then in all likelyhood the rows will come back in the same order each time...

However you are inserting rows into the table, so there is a good chance that the optimiser may "change it's mind" at some point in time. Also, most of our comments have been about returning the rows in the same sequence each time... Promising that this sequence will also match the order in which they are inserted becomes even more difficult. Even today the query may be using an index (depending on the where clause) which may result in a traversal of your table that does not match the insertion order.

For example, if you had an index on "delivery_date" and your query was "select * where delivery_date > sysdate" then the result set will most likely appear sorted by delivery_date, since the index is sorted. Delivery_date may have nothing to do with the order of inserting rows into your table however, since different products may have different delivery schedules.

Therefore what your are asking for is really quite unpredictable. Indeed, I have seen cases where index hints are used to return rows in a specific order without using an order by clause, and these rows definitely don't match their insertion order. Using a hint to force the order of a result set makes me cringe - although it does perform very fast, and can be combined with "where rownum < 100" to return the earliest 100 rows without even reading more than 100 rows from the table - a cute trick.

hth,

     Mark.

                    "Ratnesh Kumar
                    Singh"                To:     Multiple recipients of
list ORACLE-L <ORACLE-L_at_fatcity.com>
                    <ratnesh.singh@       cc:
                    patni.com>            Subject:     RE: will the Return
Order of rows change with time ?
                    Sent by:
                    root_at_fatcity.co
                    m


                    23/10/2002
                    16:58
                    Please respond
                    to ORACLE-L






Thanks a lot to all those people who replied to my query. answering stephane question : the table is 500MB+ , and there is no unique key since it is a child table. Moreover presently i cannot modify the table.

The general concensus is that there is no guarantee of return order of rows without using order by clause. Anybody knows why this is so ?
Oracle must be having a fixed algorith for data access , probably using the extent map.

Assuming
1. no query parallelism & no deletes/updates to table 2. no index/optimizer/structure changes
the data retrieval path should not change with time for the same query ??

thanks & regards
ratnesh singh

-----Original Message-----

Kumar Singh
Sent: Tuesday, October 22, 2002 4:09 PM
To: Multiple recipients of list ORACLE-L

Hi

I have a very large DW table in which there are only inserts and NO updates/deletes.The table grows by around 2-5 % every week due to new inserts.

I need to return the rows for each customer in the same order as inserted to
table.Due to design/delivery constraints , i cannot modify the table.

ques 1 : if i do a 'select * from table' with where clause but no order by clause,will the Order of rows returned be the same whenever this query is executed ? Is this guaranteed by Oracle ?

ques 2 : if i export/import this table , then execute the same query, will the Order of rows returned be the same as before the export/import ?

ques 3 : if i use the 'move' cmd to rebuild this table , then execute my query,will the Order of rows returned be the same as before the rebuild ?

any explanations are most welcome....

many thanks
ratnesh singh



Ratnesh Kumar Singh
Sr. Software Engineer
Patni Computer Systems Ltd
TTC Mahape , Navi Mumbai
Work : (91 22) 7611090/110/128/350 Ext. 2107/2106 Home : (91 22) 8662162
http://www.patni.com
World-Wide Partnerships. World-Class Solutions.

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Ratnesh Kumar Singh
  INET: ratnesh.singh_at_patni.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services

---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Ratnesh Kumar Singh
  INET: ratnesh.singh_at_patni.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services

---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<---->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>

   Privileged/Confidential information may be contained in this message.

          If you are not the addressee indicated in this message
       (or responsible for delivery of the message to such person),
            you may not copy or deliver this message to anyone.
In such case, you should destroy this message and kindly notify the sender
           by reply e-mail or by telephone on (61 3) 9612-6999.
   Please advise immediately if you or your employer does not consent to
                Internet e-mail for messages of this kind.
        Opinions, conclusions and other information in this message
              that do not relate to the official business of
                         Transurban City Link Ltd
         shall be understood as neither given nor endorsed by it.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<---->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Mark Richard
  INET: mrichard_at_transurban.com.au

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services

---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Ratnesh Kumar Singh
  INET: ratnesh.singh_at_patni.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services

---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Wed Oct 23 2002 - 03:58:39 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US