<SPAN
class=912384305-17052001>Hello,
Thanks
Lisa for your comment but.
<SPAN
class=912384305-17052001>
I try
to always <SPAN
class=912384305-17052001>use an index hint to return the rows in the required
order. This avoids a sort....
if
it's possible to use an index which can avoid both sort and table access - and
it often won't be possible - the this index will offer good performance both for
retrieval of all rows and the retreival of the first row.
<SPAN
class=912384305-17052001>
<SPAN
class=912384305-17052001>
<SPAN
class=912384305-17052001>Ranganath : What is the name of your index on
editor_choice ?
<SPAN
class=912384305-17052001>
<SPAN
class=912384305-17052001>Regards
<SPAN
class=912384305-17052001>Henrik
<FONT face=Tahoma
size=2>-----Original Message-----From: Koivu, Lisa
[mailto:lkoivu_at_qode.com]Sent: den 16 maj 2001 16:37To:
Multiple recipients of list ORACLE-LSubject: RE: Imedia query
tuning
Henrik, FYI
The ordered hint refers to the order in which the tables are
accessed in the query. It has nothing to do with an index.
Lisa Rutland Koivu
Oracle Database Administrator <FONT
size=2>Certified Self-Important Database Deity Slayer
of Unix Administrators Wanton Kickboxing
Goddess
lkoivu_at_qode.com
NeoMedia
2201 Second St., Suite 600 Fort
Myers, FL 33901, USA Phone: 941-337-3434
Fax: 941-337-3668 www.neom.com <<A
href="http://www.neom.com" target=_blank>http://www.neom.com>
www.paperclick.com <<A
href="http://www.paperclick.com"
target=_blank>http://www.paperclick.com> <FONT
size=2>www.qode.com <<A href="http://www.qode.com"
target=_blank>http://www.qode.com> <FONT
size=2> P a p e r C l i c k . c o m <<A
href="http://www.paperclick.com/home.htm"
target=_blank>http://www.paperclick.com/home.htm> <FONT
size=2>
Enter Your PaperClick Code Here! <FONT
size=2>
-----Original Message----- From:
Henrik Ekenberg [<A
href="mailto:henrik.ekenberg_at_anoto.com">mailto:henrik.ekenberg_at_anoto.com]
Sent: Wednesday, May 16, 2001 8:56 AM <FONT
size=2>To: Multiple recipients of list ORACLE-L <FONT
size=2>Subject: Re: Imedia query tuning
Hello,
I'm not a guru : I just try to help you. :->
Hint for Query 2 : Have you try to
hint so you run on the editor_choice index. If it <FONT
size=2>works. Can you remove the Order command. Because the index is
already ordered.
Regards Henrik E.
On Wed, 16 May 2001, Ranganath K wrote:
> Dear DBA Gurus, >
> I have the following two
queries along with execution plan and statistics. >
The first one is taking a long time to execute. The second query is
taking > a long time to execute when I use the
order by clause. Is there any way I > can
reduce the execution time as these queries will be used by a search
> engine? Any help in this regard will be greatly
appreciated. > > SQL>
select depth, count(*) a from category, site <FONT
size=2>> 2 where (site.fk_category in (select
pk_category_id from category > 3
where category.status = 0)) and site.status = 0 <FONT
size=2>> 4 and ((contains (title,'box') > 0) or
> 5 (contains (description, 'box') >
0)) > 6 and pk_category_id =
fk_category group by depth order by a desc; <FONT
size=2>> > 467 rows selected. <FONT
size=2>> > Elapsed: 00:00:16.43 <FONT
size=2>> > Execution Plan <FONT
size=2>> ----------------------------------------------------------
> 0 SELECT
STATEMENT Optimizer=CHOOSE (Cost=214936 Card=22470 By <FONT
size=2>>
tes=136572660) > <FONT
size=2>> 1 0 SORT (ORDER
BY) (Cost=214936 Card=22470 Bytes=136572660) <FONT
size=2>> 2 1
SORT (GROUP BY) (Cost=214936 Card=22470 Bytes=136572660) <FONT
size=2>> 3
2 NESTED LOOPS (Cost=19 Card=22470
Bytes=136572660) >
4 3 NESTED
LOOPS (Cost=4 Card=15 Bytes=60945) <FONT
size=2>> 5
4 TABLE ACCESS (BY
INDEX ROWID) OF 'SITE' (Cost=2 Ca <FONT
size=2>> rd=1
Bytes=4037) > <FONT
size=2>> 6
5
BITMAP CONVERSION (TO ROWIDS) >
7
6
BITMAP OR > 8
7
BITMAP CONVERSION (FROM ROWIDS) >
9
8
SORT (ORDER BY) > 10
9
DOMAIN INDEX OF 'SITE2TITLEIDEX' (Cost=1 <FONT
size=2>>
) > >
11
7
BITMAP CONVERSION (FROM ROWIDS) >
12
11
SORT (ORDER BY) > 13
12
DOMAIN INDEX OF 'SITE1DESCIDX' (Cost=1) <FONT
size=2>> 14
4 TABLE ACCESS (BY
INDEX ROWID) OF 'CATEGORY' (Cost= <FONT
size=2>> 1
Card=1499 Bytes=38974) > <FONT
size=2>> 15
14
INDEX (UNIQUE SCAN) OF 'SYS_C001314' (UNIQUE) <FONT
size=2>> 16
3 TABLE ACCESS (BY INDEX
ROWID) OF 'CATEGORY' (Cost=1 <FONT
size=2>>
Card=149802 Bytes=301851030) > <FONT
size=2>> 17
16 INDEX (UNIQUE
SCAN) OF 'SYS_C001314' (UNIQUE) > <FONT
size=2>> Statistics >
- <FONT
size=2>> 786
recursive calls <FONT
size=2>> 40 db
block gets <FONT
size=2>> 5919 consistent
gets >
1389 physical reads <FONT
size=2>>
0 redo size >
1829532 bytes sent via SQL*Net to client <FONT
size=2>> 69737 bytes received via
SQL*Net from client <FONT
size=2>> 920 SQL*Net
roundtrips to/from client <FONT
size=2>> 13
sorts (memory) <FONT
size=2>>
0 sorts (disk) <FONT
size=2>> 467 rows
processed > > SQL>
select depth, title, description, url, editor_choice from category,site
> 2 where (site.fk_category in (select
pk_category_id from category > 3
where category.status = 0)) and site.status = 0 <FONT
size=2>> 4 and site.fk_category =
category.pk_category_id > 5 and
((contains (title, 'box') > 0) or >
6 (contains (description, 'box' ) > 0)) order by editor_choice
desc; > > 552 rows
selected. > > Elapsed:
00:00:16.94 > >
Execution Plan >
- <FONT
size=2>> 0 SELECT STATEMENT
Optimizer=CHOOSE (Cost=142941 Card=22470 By <FONT
size=2>>
tes=181714890) > <FONT
size=2>> 1 0 SORT (ORDER
BY) (Cost=142941 Card=22470 Bytes=181714890) <FONT
size=2>> 2 1
NESTED LOOPS (Cost=19 Card=22470 Bytes=181714890) <FONT
size=2>> 3
2 NESTED LOOPS (Cost=4 Card=15
Bytes=91080) >
4 3 TABLE
ACCESS (BY INDEX ROWID) OF 'SITE' (Cost=2 Card <FONT
size=2>> =1
Bytes=6046) > <FONT
size=2>> 5
4 BITMAP
CONVERSION (TO ROWIDS) >
6
5
BITMAP OR > 7
6
BITMAP CONVERSION (FROM ROWIDS) >
8
7
SORT (ORDER BY) >
9
8
DOMAIN INDEX OF 'SITE2TITLEIDEX' (Cost=1) <FONT
size=2>> 10
6
BITMAP CONVERSION (FROM ROWIDS) >
11
10
SORT (ORDER BY) > 12
11
DOMAIN INDEX OF 'SITE1DESCIDX' (Cost=1) <FONT
size=2>> 13
3 TABLE ACCESS (BY INDEX
ROWID) OF 'CATEGORY' (Cost=1 <FONT
size=2>>
Card=1499 Bytes=38974) > <FONT
size=2>> 14
13 INDEX (UNIQUE
SCAN) OF 'SYS_C001314' (UNIQUE) >
15 2 TABLE ACCESS (BY
INDEX ROWID) OF 'CATEGORY' (Cost=1 Ca <FONT
size=2>>
rd=149802 Bytes=301851030) > <FONT
size=2>> 16
15 INDEX (UNIQUE SCAN) OF
'SYS_C001314' (UNIQUE) > <FONT
size=2>> Statistics >
- <FONT
size=2>> 781
recursive calls <FONT
size=2>> 66 db
block gets <FONT
size=2>> 6930 consistent
gets >
1708 physical reads <FONT
size=2>>
0 redo size >
2244834 bytes sent via SQL*Net to client <FONT
size=2>> 252240 bytes received via
SQL*Net from client <FONT
size=2>> 2265 SQL*Net
roundtrips to/from client <FONT
size=2>> 11
sorts (memory) <FONT
size=2>>
1 sorts (disk) <FONT
size=2>> 552 rows
processed > > TIA and
Regards, > >
Ranganath > >
>
- <FONT
size=2>---------------------------------------------------------------------------
Henrik
Ekenberg
Anoto AB Direct +46 (0)8 410 78
577
Vasagatan 7 Mobile +46 (0)733
478
577
111 20 Stockholm, Sweden <FONT
size=2>www.anoto.com
Switchb. +46 (0)8 406 79 00 E-mail
:henrik.ekenberg_at_anoto.com
Fax +46 (0)8 406 79 50
- Please see the official ORACLE-L
FAQ: <A href="http://www.orafaq.com"
target=_blank>http://www.orafaq.com --
Author: Henrik Ekenberg
INET: henrik.ekenberg_at_anoto.com
Fat City Network Services -- (858)
538-5051 FAX: (858) 538-5051 San Diego,
California -- Public Internet access
/ Mailing Lists <FONT
size=2>--------------------------------------------------------------------
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 Thu May 17 2001 - 01:06:20 CDT