February 7, 2011 at 8:56 am
I need to query a production Oracle 9i database. I will be selecting all columns from a table that has about 10 million rows.
Unfortunately, there is not a test server available.
How can I query for the top 1000 records (no particular order) and be sure I'm not taxing the server?
February 7, 2011 at 9:56 am
sqlgreg (2/7/2011)
I need to query a production Oracle 9i database. I will be selecting all columns from a table that has about 10 million rows.Unfortunately, there is not a test server available.
How can I query for the top 1000 records (no particular order) and be sure I'm not taxing the server?
Oracle does not supports "TOP" syntax.
For random rows with no particular order...
select mycolumn
from mytable
where rownum < 1000;
If you want columns sorted...
select * from (
select mycolumn
from mytable
order by mycolumn)
where rownum < 1000;
_____________________________________
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at Amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.February 7, 2011 at 10:23 am
I was just about the post the answer when I saw your reply! Thanks!
I didn't know what to search for in the Oracle documentation.
February 7, 2011 at 10:43 am
sqlgreg (2/7/2011)
I was just about the post the answer when I saw your reply! Thanks!I didn't know what to search for in the Oracle documentation.
That's why God created forums 😀
_____________________________________
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at Amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.March 7, 2011 at 5:17 pm
Oracle has a very good documentation and excellent site that answers your even the toughest questions in detail by a true Oracle master: Thomas Kyte http://asktom.oracle.com
Top N question was piece-of-cake, complete beginner's question.
March 10, 2011 at 1:01 pm
Vedran Kesegic (3/7/2011)
Top N question was piece-of-cake, complete beginner's question.
I'm failing to see the value of this particular post.
Also, why you have to be rude to the original poster?
_____________________________________
Pablo (Paul) Berzukov
Author of Understanding Database Administration available at Amazon and other bookstores.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.March 10, 2011 at 1:32 pm
Dear sqlgreg, Sorry, I didn't mean to be rude. Just wanted to point out that asktom.com has profound answers on even the most complicated questions. Maybe I expressed that in a wrong way. I apologize sincerely and thanky you PaulB that you made me aware of that.
March 10, 2011 at 3:58 pm
Thanks, Paul, and no problem, Vedran.
I agree that asktom.oracle.com is quite helpful; I found that site quite useful when I was working with Oracle last month.
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply