Solved

SELECT MAX(TO_NUMBER(COL1)) FROM TABLE1 WHERE COL2=&VAL2;

Posted on 2001-07-05
9
3,095 Views
Last Modified: 2010-08-05
How to optimize the select statement?

COL1 is of char(15).
TABLE1 is hash-partitioned on COL2.
Hash-partitioned non-unique index on COL2.

Oracle version 8.1.7.1
0
Comment
Question by:ooiewe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 9

Expert Comment

by:dbalaski
ID: 6258351
Need a little more info -- please post the actual select statement...
Also --  do you have a current explain plan on the query

dB
0
 
LVL 9

Expert Comment

by:dbalaski
ID: 6258359
never mind the query --  I just noticed it was the title of the message

still the current explain plan would be helpful --
what is the apx size of the table ?  # of partitions?    apx distribution on col2??

dB
0
 

Author Comment

by:ooiewe
ID: 6258438
SELECT STATEMENT, COST=1, CARDINALITY=1
SORT AGGREGATE, COST=1, CARDINALITY=1
TABLE ACCESS BY LOCAL INDEX ROWID TABLE1, COST=1,CARDINALITY = 2605
INDEX RANGE SCAN IDX_COL2_ON_TABLE1, COST=1, CARDINALITY=2605

15 millions records
# of partitions = 4
0.1% (1 in 1000 records)

Additional info :
AVG_ROW_LEN=103
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 

Expert Comment

by:shikhadh
ID: 6258568
probably something wrong inthe memory.memory optimisation needs to be done.i would suggest u to use tkprof instaed of explan plan and then see what is wrong where
0
 

Expert Comment

by:wlang
ID: 6260196
If you can change col1 to number instead of char, it helps. Or you can create function index on col1 (oracle 8i)
0
 
LVL 9

Accepted Solution

by:
dbalaski earned 200 total points
ID: 6260291
That is not too bad --  the only thing I can think of is to avoid the sort ...

One way you can do this:
build a composite index on   (COL1,COL2)
this would produce an index range scan
maybe you could then apply an INDEX_FFS
hint..

The only thing I can think of at the moment...

dB
0
 
LVL 9

Expert Comment

by:dbalaski
ID: 6260383
This went in as a proposed answer -- it was supposed to be a comment...  must be a glitch,  I know comment was checked off.

dB
0
 

Author Comment

by:ooiewe
ID: 6261420
Function index is possible in general to speed up similar query, but it will slow down DML.

Give me some time to try out the proposed indexing.
0
 

Author Comment

by:ooiewe
ID: 6411896
You have answered my question correctly. For your info, Oracle is using INDEX_FFS even though it is not specified as a hint. Thanks alot.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question