![]() | |
![]() |
| | Thread Tools | Display Modes |
#11
| |||
| |||
|
#12
| |||
| |||
|
|
Hi, thank you for your reply. Maybe, maybe not. It would be interesting and helpful to learn your WHERE conditions for implicit assignments. ok, complete example here. Please use the tables from post 4 as prerequesites; in addition, this table is created: TABLE EMPLOYEE_CONTRACTS: === - ident_id NUMBER - contract_start DATE - contract_end DATE Now, for the implicit assignments (create view): SELECT ec.ident_id, 1421 FROM emloyee_contracts ec WHERE contract_end IS NULL /* Dynamic group of all indefinitely employed people */ UNION ALL SELECT ec.ident_id, 210 FROM emloyee_contracts ec LEFT JOIN identity i ON i.id=ec.ident_id WHERE UPPER(i.name) LIKE 'S%' |
|
/* Dynamic group of all people whose name starts with 's' */ UNION ALL SELECT i.ident_id, 19920 FROM identity i LEFT JOIN emloyee_contracts ec ON i.id=ec.ident_id LEFT JOIN explicit_assign ea ON ea.ident_id = i.id WHERE EXISTS ea.group_id AND ec.contract_end< SYSDATE /* Dynamic group of all people who are not employed any more and still have an explicit group membership somewhere */ |
#13
| |||
| |||
|
|
Don't get me wrong: The solution with the view from first post works technically. It's just damn slow with a growing number of UNION ALL statements. But perhaps it's really not solvable on dbms level. |
#14
| |||
| |||
|
|
Well, you can upgrade. *http://blogs.oracle.com/optimizer/20...nsformations_j... Ah, thank you very much for your input, however, even 11g will not |
#15
| |||
| |||
|
|
On 15 Mrz., 22:25, joel garry <joel-ga... (AT) home (DOT) com> wrote:> Well, you canupgrade. *http://blogs.oracle.com/optimizer/20...nsformations_j... Ah, thank you very much for your input, however, even 11g will not solve my difficulties since they do not result from slow singluar queries. All the UNION ALL contents from above are in fact supported by appropriate indices; what makes the query slow is that the view will always be executed completely; if there are 2000 small, but fast queries being executed the whole result becomes slow anyway. So, I'd need a way to tell the DBMS only to execute the appropriate UNION ALL line(s) which by design is not possible because the required line number will first be available _after_ the execution of the statement. I thought that the explain plan somehow would give a hint on which part shall be executed, but apparently it does not. So unless there is a way to feed parts of a "WHERE" clause into a function parameter set automatically (maybe only via highly specialized triggers) I fear I cannot solve my dilemma... Thanks again, NewUser2k8 |
![]() |
| Thread Tools | |
| Display Modes | |
| |