![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| ||||
| ||||
|
|
| p_userrole | '.' | p_tablename | ' for ' | p_table_owner | '.' | p_tablename | ';' ); |
|
| p_toplevel_grantee ); |
|
| p_userrole | '.' | p_tablename | ' for ' | p_table_owner | '.' | p_tablename ); |
|
| DECODE (owner, 'PUBLIC', 'PUBLIC', '') | ' synonym ' | DECODE (owner, 'PUBLIC', ' ', owner || '.') | synonym_name cre, table_owner || '.' || table_name || ' no longer |
#2
| |||
| |||
|
|
Hello, I've developed a script file which fixes (creates or drops) synonym statements for all users which have been granted access for current user's objects. It can even trace the privileges inherited through roles. It works OK but the performance is way too slow if the database is big. I have traced the problem to this sql satement: SELECT owner * * * * * * *FROM all_synonyms * * * * * * *WHERE table_name = UPPER ('EMP') * * * * * * * *AND synonym_name = UPPER ('EMP') * * * * * * * *AND table_owner = 'SCOTT' * * * * * * * *AND (owner = 'SYSTEM' OR owner = 'PUBLIC'); The explain plan for this rather simple query looks like this! (I am using Oracle 10.2.0.2.0 on Windows platform: Am I doing something wrong as the explain plan looks rather complex for this simple query? |
#3
| |||
| |||
|
|
Hello, I've developed a script file which fixes (creates or drops) synonym statements for all users which have been granted access for current user's objects. It can even trace the privileges inherited through roles. It works OK but the performance is way too slow if the database is big. I have traced the problem to this sql satement: SELECT owner * * * * * * *FROM all_synonyms * * * * * * *WHERE table_name = UPPER ('EMP') * * * * * * * *AND synonym_name = UPPER ('EMP') * * * * * * * *AND table_owner = 'SCOTT' * * * * * * * *AND (owner = 'SYSTEM' OR owner = 'PUBLIC'); The explain plan for this rather simple query looks like this! (I am using Oracle 10.2.0.2.0 on Windows platform: Am I doing something wrong as the explain plan looks rather complex for this simple query? |
#4
| |||
| |||
|
|
Hello, I've developed a script file which fixes (creates or drops) synonym statements for all users which have been granted access for current user's objects. It can even trace the privileges inherited through roles. It works OK but the performance is way too slow if the database is big. I have traced the problem to this sql satement: SELECT owner * * * * * * *FROM all_synonyms * * * * * * *WHERE table_name = UPPER ('EMP') * * * * * * * *AND synonym_name = UPPER ('EMP') * * * * * * * *AND table_owner = 'SCOTT' * * * * * * * *AND (owner = 'SYSTEM' OR owner = 'PUBLIC'); The explain plan for this rather simple query looks like this! (I am using Oracle 10.2.0.2.0 on Windows platform: Am I doing something wrong as the explain plan looks rather complex for this simple query? |
#5
| |||
| |||
|
|
Hello, I've developed a script file which fixes (creates or drops) synonym statements for all users which have been granted access for current user's objects. It can even trace the privileges inherited through roles. It works OK but the performance is way too slow if the database is big. I have traced the problem to this sql satement: SELECT owner * * * * * * *FROM all_synonyms * * * * * * *WHERE table_name = UPPER ('EMP') * * * * * * * *AND synonym_name = UPPER ('EMP') * * * * * * * *AND table_owner = 'SCOTT' * * * * * * * *AND (owner = 'SYSTEM' OR owner = 'PUBLIC'); The explain plan for this rather simple query looks like this! (I am using Oracle 10.2.0.2.0 on Windows platform: Am I doing something wrong as the explain plan looks rather complex for this simple query? |
#6
| |||
| |||
|
|
On Mar 26, 12:54*am, Kirmo Uusitalo <n... (AT) exists (DOT) com.invalid> wrote: I have traced the problem to this sql satement: SELECT owner * * * * * * *FROM all_synonyms * * * * * * *WHERE table_name = UPPER ('EMP') * * * * * * * *AND synonym_name = UPPER ('EMP') * * * * * * * *AND table_owner = 'SCOTT' * * * * * * * *AND (owner = 'SYSTEM' OR owner = 'PUBLIC'); The explain plan for this rather simple query looks like this! (I am using Oracle 10.2.0.2.0 on Windows platform: Am I doing something wrong as the explain plan looks rather complex for this simple query? Remember, all_synonyms is a view, with exists and unions. You may have more luck dealing with the underlying tables. Or maybe David's suggestion will be good enough for the optimizer to sort through all that stuff. |
|
jg |
#7
| |||
| |||
|
|
On Mar 26, 12:54*am, Kirmo Uusitalo <n... (AT) exists (DOT) com.invalid> wrote: I have traced the problem to this sql satement: SELECT owner * * * * * * *FROM all_synonyms * * * * * * *WHERE table_name = UPPER ('EMP') * * * * * * * *AND synonym_name = UPPER ('EMP') * * * * * * * *AND table_owner = 'SCOTT' * * * * * * * *AND (owner = 'SYSTEM' OR owner = 'PUBLIC'); The explain plan for this rather simple query looks like this! (I am using Oracle 10.2.0.2.0 on Windows platform: Am I doing something wrong as the explain plan looks rather complex for this simple query? Remember, all_synonyms is a view, with exists and unions. You may have more luck dealing with the underlying tables. Or maybe David's suggestion will be good enough for the optimizer to sort through all that stuff. |
|
jg |
#8
| |||
| |||
|
|
On Mar 26, 12:54*am, Kirmo Uusitalo <n... (AT) exists (DOT) com.invalid> wrote: I have traced the problem to this sql satement: SELECT owner * * * * * * *FROM all_synonyms * * * * * * *WHERE table_name = UPPER ('EMP') * * * * * * * *AND synonym_name = UPPER ('EMP') * * * * * * * *AND table_owner = 'SCOTT' * * * * * * * *AND (owner = 'SYSTEM' OR owner = 'PUBLIC'); The explain plan for this rather simple query looks like this! (I am using Oracle 10.2.0.2.0 on Windows platform: Am I doing something wrong as the explain plan looks rather complex for this simple query? Remember, all_synonyms is a view, with exists and unions. You may have more luck dealing with the underlying tables. Or maybe David's suggestion will be good enough for the optimizer to sort through all that stuff. |
|
jg |
#9
| |||
| |||
|
|
On Mar 26, 12:54*am, Kirmo Uusitalo <n... (AT) exists (DOT) com.invalid> wrote: I have traced the problem to this sql satement: SELECT owner * * * * * * *FROM all_synonyms * * * * * * *WHERE table_name = UPPER ('EMP') * * * * * * * *AND synonym_name = UPPER ('EMP') * * * * * * * *AND table_owner = 'SCOTT' * * * * * * * *AND (owner = 'SYSTEM' OR owner = 'PUBLIC'); The explain plan for this rather simple query looks like this! (I am using Oracle 10.2.0.2.0 on Windows platform: Am I doing something wrong as the explain plan looks rather complex for this simple query? Remember, all_synonyms is a view, with exists and unions. You may have more luck dealing with the underlying tables. Or maybe David's suggestion will be good enough for the optimizer to sort through all that stuff. |
|
jg |
#10
| |||
| |||
|
|
On Wed, 26 Mar 2008 17:28:45 -0700 (PDT), joel garry joel-ga... (AT) home (DOT) com> wrote: On Mar 26, 12:54*am, Kirmo Uusitalo <n... (AT) exists (DOT) com.invalid> wrote: I have traced the problem to this sql satement: SELECT owner * * * * * * *FROM all_synonyms * * * * * * *WHERE table_name = UPPER ('EMP') * * * * * * * *AND synonym_name = UPPER ('EMP') * * * * * * * *AND table_owner = 'SCOTT' * * * * * * * *AND (owner = 'SYSTEM' OR owner = 'PUBLIC'); The explain plan for this rather simple query looks like this! (I am using Oracle 10.2.0.2.0 on Windows platform: Am I doing something wrong as the explain plan looks rather complex for this simple query? Remember, all_synonyms is a view, with exists and unions. *You may have more luck dealing with the underlying tables. *Or maybe David's suggestion will be good enough for the optimizer to sort through all that stuff. Yes I am aware of this. But as far as I know the views stay the same between Oracle versions but the underlying table structures may change. This is why I prefer using the view instead. I tried David Fitzjarrell's suggestion, running *this) dbms_stats.gather_fixed_objects_stats(NULL). It seemed to improve running time a little, but still running this fixsyn.sql against one table in a *small database (around 50 users) takes about 2,5 seconds which seems to me quite a long time for such a simple task. Thank you all for these! |
![]() |
| Thread Tools | |
| Display Modes | |
| |