Unix Technical Forum

Indexing properties that belong to types

This is a discussion on Indexing properties that belong to types within the Oracle Miscellaneous forums, part of the Oracle Database category; --> Our database has a table of types. I can do a select from the table, making a restriction on ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 09:06 AM
Ryan
 
Posts: n/a
Default Indexing properties that belong to types

Our database has a table of types. I can do a select from the table,
making a restriction on the fields that are on the type.

i.e. my table of 'trades' has a reference to a sub_trade type. I want
to query my trades where the sub_trade type has a particular id. I can
do this:

SELECT t.trade_ref, t.trade_date
FROM trades t
WHERE t.sub_trade.st_ref LIKE 'B00000001'

(I have simplified the actual SQL we are running)

This works, but my table of trades is relatively large (c100,000 rows)
and there are many instances of the sub_trade types (c200,000). An
explain plan shows a full table scan, so unsurpisingly, the SQL is very
slow and will continue to get slower.

Is there any way I can index this query? I can't index the trade column
of the sub_trades table (ORA-02327: cannot create index on expression
with datatype REF) nor can I add an index on trade_ref to the trade
type (ORA-04044: procedure, function, package, or type is not allowed
here)

I need to improve the perfoemance of such a query. If I cannot add an
index, is there an alternative way to improve the performance? if
anybody has any links to information for optimising object-type
queries, please post them - I'd really appreaciate it.

(I cannot change the schema; it's delivered by a 3rd party software
supplier)

Thank you very much for any help


Ryan

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 09:06 AM
DA Morgan
 
Posts: n/a
Default Re: Indexing properties that belong to types

Ryan wrote:

> I can do this:
>
> SELECT t.trade_ref, t.trade_date
> FROM trades t
> WHERE t.sub_trade.st_ref LIKE 'B00000001'


You can?

Equals I could understand ... '%B00000001%' I could understand.

But like without wildcard characters?
--
Daniel A. Morgan
http://www.psoug.org
damorgan@x.washington.edu
(replace x with u to respond)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 09:07 AM
William Robertson
 
Posts: n/a
Default Re: Indexing properties that belong to types

Ryan wrote:
> Our database has a table of types. I can do a select from the table,
> making a restriction on the fields that are on the type.
>
> i.e. my table of 'trades' has a reference to a sub_trade type. I want
> to query my trades where the sub_trade type has a particular id. I can
> do this:
>
> SELECT t.trade_ref, t.trade_date
> FROM trades t
> WHERE t.sub_trade.st_ref LIKE 'B00000001'
>
> (I have simplified the actual SQL we are running)
>
> This works, but my table of trades is relatively large (c100,000 rows)
> and there are many instances of the sub_trade types (c200,000). An
> explain plan shows a full table scan, so unsurpisingly, the SQL is very
> slow and will continue to get slower.
>
> Is there any way I can index this query? I can't index the trade column
> of the sub_trades table (ORA-02327: cannot create index on expression
> with datatype REF) nor can I add an index on trade_ref to the trade
> type (ORA-04044: procedure, function, package, or type is not allowed
> here)
>
> I need to improve the perfoemance of such a query. If I cannot add an
> index, is there an alternative way to improve the performance? if
> anybody has any links to information for optimising object-type
> queries, please post them - I'd really appreaciate it.
>
> (I cannot change the schema; it's delivered by a 3rd party software
> supplier)
>
> Thank you very much for any help
>
>
> Ryan


Could you post some DDL? I'm wondering whether there is a way to find
the underlying table beneath all that O-R fluff and put an index on
that, but I'd have to poke around a bit. An example would help.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:33 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com