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

Home -> Community -> Usenet -> c.d.o.misc -> Re: ``limit'' in Oracle?

Re: ``limit'' in Oracle?

From: Brian Tkatch <SPAMBLOCK.Maxwell_Smart_at_ThePentagon.com.SPAMBLOCK>
Date: Fri, 16 Nov 2001 13:08:39 GMT
Message-ID: <3bf50e7c.831813234@news.alt.net>


On Fri, 16 Nov 2001 12:24:09 GMT, Brian Lee <senux_at_senux.com.NOSPAM> wrote:

>Hi,
>
>I'm newbie at Oracle database. I want to get some part of data from
>Oracle database. I did follow SQL sentence in Oracle and it works.
>But it's very slow to get the result because the table is very huge.
>Is there more fast way to get result? I use ``limit'' function in MySQL for
>this case but I don't know how to do this in Oracle.
>
>select * from
> ( select rownum as mynum, * from big_log_tab where ip like '2%')
> where mynum between 100 and 110 order by datetime
>
>Sorry for short English but I am really waiting for a reply for this
>posting. Thank you a lot!
>
>--
>Brian Lee - http://www.senux.com/

Do you have an index on ip?

Also, technically, the inner query gives back rows out of order, and only the outer ORDER BY helps. But then it is too late.

Instead:
SELECT * FROM
 ( SELECT ROWNUM MyNum, * FROM

	(SELECT * FROM Big_Log_Tab
	 WHERE ip LIKE '2% ORDER BY DateTime)
       WHERE ROWNUM <= 110)

WHERE MyNum > 100

Brian Received on Fri Nov 16 2001 - 07:08:39 CST

Original text of this message

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