Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Optimizer doesn't use materialize hint with user-defined type

4153789Dec 16 2019 — edited Dec 17 2019

Hello, community.
We faced some intresting issue with Oracle 11.2.0.3 EE.

We have created a type

create or replace type test_t as object ( test1 number, test2 number)

And two tables

create table test1 (

id number,

test2_id number,

test_value varchar2(25)

)

create table test2 (

id number,

test_value2 test_t

)

And then we wanted to join it by with clause and materilize hint

This one will create exactly that plan which we desired

with sql1 as

(select /*+ materialize */

t1.test_value, t2.id

from test1 t1 , test2 t2

where t1.test2_id = t2.id )

select * from sql1

pastedImage_18.png

But when we just add our column with type test_t (that we've created by own), plan doesn't meet our expectation

with sql1 as

(select /*+ materialize */

t1.test_value, t2.id, t2,test_value

from test1 t1 , test2 t2

where t1.test2_id = t2.id )

select * from sql1

pastedImage_19.png

What we are doing wrong? Or oracle doesn't support materialize hint (or maybe other also) for user-defined type at all?

Would be appreciate for any clue.

Comments
Post Details
Added on Dec 16 2019
8 comments
578 views