| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to speed up this query
For 1 use bind variables.
2. What version of Oracle? 3. Have you analyzed the tables and indexes? 4. For the 2nd query what is the execution plan? (clearly it is using moreIO)
"Andy Rigby" <andy_at_softap.co.uk> wrote in message
news:56c32d01.0202150444.1d5ae2f_at_posting.google.com...
> I have a table of approx 50,000 rows. My Visual C/ADO app generates
> large numbers of requests of this type - see below (the app requires
> 'pagefulls' of 12 rows so I use one of the standard 'top n' tricks) :
>
> SELECT *
> FROM
> (SELECT * FROM TBL19 WHERE LRN>130345 ORDER BY LRN)
> WHERE ROWNUM<=12
>
> The timings and I/O for this as reported by TRACE is excellent, i.e:
>
>
> call count cpu elapsed disk query current
> rows
> ------- ------ -------- ---------- ---------- ---------- ----------
> ----------
> Parse 1 0.00 0.00 0 0 0
> 0
> Execute 1 0.00 0.00 0 0 0
> 0
> Fetch 2 0.00 0.00 0 5 0
> 12
> ------- ------ -------- ---------- ---------- ---------- ----------
> ----------
> total 4 0.00 0.00 0 5 0
> 12
>
> Misses in library cache during parse: 1
> Optimizer goal: CHOOSE
> Parsing user id: 25
>
> Rows Row Source Operation
> ------- ---------------------------------------------------
> 12 COUNT STOPKEY
> 12 VIEW
> 12 TABLE ACCESS BY INDEX ROWID TBL19
> 12 INDEX RANGE SCAN (object id 4148)
>
>
![]() |
![]() |