473,499 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

selecting ROWNUM causes query to take forever

I have a query that takes about two minutes and returns 97 rows.
If I change the query only by adding ROWNUM to the outermost
select clause, the query never returns (I let it run overnight).
I'm not using ROWNUM in the where clause, I'm just selecting it.
I can't think of any reason that just selecting ROWNUM would make any
difference. This is Orace 8.1

I spent a day searching Google groups without finding anything on this.

Any ideas?

Thanks in advance,

Paul
Jul 19 '05 #1
2 3950
Paul Bradford wrote:
I have a query that takes about two minutes and returns 97 rows.
If I change the query only by adding ROWNUM to the outermost
select clause, the query never returns (I let it run overnight).
I'm not using ROWNUM in the where clause, I'm just selecting it.
I can't think of any reason that just selecting ROWNUM would make any
difference. This is Orace 8.1

I spent a day searching Google groups without finding anything on this.

Any ideas?

Thanks in advance,

Paul

Crystal ball is in the repair shop. Why not post the query, explain
plan, etc?

--
Regards, Frank van Bortel

Jul 19 '05 #2
> Paul Bradford wrote:
I have a query that takes about two minutes and returns 97 rows.
If I change the query only by adding ROWNUM to the outermost
select clause, the query never returns (I let it run overnight).
I'm not using ROWNUM in the where clause, I'm just selecting it.
I can't think of any reason that just selecting ROWNUM would make any
difference.


For reasons I don't understand, adding ROWNUM caused a different
(and worse) execution plan. After I added some hints to get a good
execution plan, my problem is solved.
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6795
by: Kevin Crosbie | last post by:
Hi all, (Sorry for the cross-post, there doesn't appear to be much activity on comp.database.oracle)I'm trying to get the last 300 rows from the difference between 2 large tables and my queries...
9
98758
by: Sandy | last post by:
I am trying to do the following: EXEC SQL UPDATE MY TABLE SET COL1 = :newValue WHERE COL1 = 0 AND ROWNUM = 1 ORDER BY COL2; (index on COL1, COL2)
8
12553
by: Agoston Bejo | last post by:
Take a look at the following example: table T(i INTEGER, j INTEGER) I want to get the value of i where j is minimal and some conditions apply. (1) SELECT i FROM T WHERE AND j
4
18266
by: pierig.gueguen | last post by:
Hello, I would like to know if the equivalent Oracle rownum exist in SQLServer. Here is a sample SQL code to explain what I want to do : select jobs.name, jobs.job_id, jobs.description,...
5
7286
by: uthuras | last post by:
Machine : AIX 5.2 Product : UDB DB2 Release 8.1 FP4a I have problem loading data into destination table. The data file is huge with more than 6 Million records. This what i have done 1....
7
3509
by: Bernard Lebel | last post by:
Hello, I'm stumbled at a serious problem, and quite frankly getting desparate. This is a rather long-winded one so I'll try to get straight to the point. I have this Python program, that...
2
36211
by: krishhhna | last post by:
If we want to retrive 5,6,7 rows from a table,then we used rownum in a query in group by clause,but my doubt is rownum has individual values for each rows then how did you group rows based on...
6
14065
by: pradeep kaltari | last post by:
Hi All, I was just going through EMP table in oracle Scott schema. Say, I want to find out the first employee in alphabetical order who's name starts with 'A'. the following query gives me the...
2
334
by: Paul Bradford | last post by:
I have a query that takes about two minutes and returns 97 rows. If I change the query only by adding ROWNUM to the outermost select clause, the query never returns (I let it run overnight). I'm...
0
7134
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7014
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7229
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5485
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4921
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4609
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1429
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
667
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
311
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.