|
|
|
|
|
|
| Author |
Message |
Francesco M. *nix forums beginner
Joined: 01 Apr 2005
Posts: 36
|
Posted: Thu Feb 24, 2005 7:48 am Post subject:
Re: Replacing a subselect with Collections
|
|
|
Hello,
thanks for your replies. Well both. I'm interested to give a try to
pl-sql collections and to make the query run a bit faster. I'm
surprised to see that the saving is really negligible if I switch from
the subselect to a pl-sql variable.
As I mentioned, from my Java background I'm accustomed to cache
everything which can be reused....but it seems that with Oracle engine
it works differently.
Thanks
Francesco |
|
| Back to top |
|
 |
mikharakiri_nospaum@yahoo *nix forums beginner
Joined: 05 Feb 2005
Posts: 46
|
Posted: Wed Feb 23, 2005 10:13 pm Post subject:
Re: Replacing a subselect with Collections
|
|
|
If anag_ptr.desc_ptr is indexed and desc_ptr = snap.ptr_a are very
selective predicates, then your query as fast as it can possibly be (on
server side). Changing those scalar subqueries into pl/sql would
achieve only performance degradation caused by context switch. |
|
| Back to top |
|
 |
DA Morgan *nix forums Guru
Joined: 06 Mar 2005
Posts: 1042
|
Posted: Wed Feb 23, 2005 4:27 pm Post subject:
Re: Replacing a subselect with Collections
|
|
|
fmarchioni@libero.it wrote:
| Quote: | Hi all oracle users,
I have a cursor which fetches a few thousand records.
Inside it I have a subselect which is used for decoding one field.
CURSOR snap_crs IS
SELECT decode (snap.id, 1,
(select code_ptr from anag_ptr where desc_ptr = snap.ptr_a),
(select code_ptr from anag_ptr where desc_ptr = snap.ptr_b)
),
..... other fields....
My question is: since * anag_ptr * is a static table (doesn't ever
change),
is it worthy to replace the subselect with values taken from a
Collection ?
Having a Java background I would use an Hashtable to insert couples
(code_ptr,desc_ptr)...but what about pl/sql ? can I do the same ?
Thanks a lot
Francesco
|
Is there a specific performance issue you are trying to address or is
this just for academic interest? My suggestion ... try it ... benchmark
it.
But be very careful about statements like "doesn't ever change." I have
seen more than a few Java coders fileted by that statement.
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace 'x' with 'u' to respond) |
|
| Back to top |
|
 |
Francesco M. *nix forums beginner
Joined: 01 Apr 2005
Posts: 36
|
Posted: Wed Feb 23, 2005 8:26 am Post subject:
Replacing a subselect with Collections
|
|
|
Hi all oracle users,
I have a cursor which fetches a few thousand records.
Inside it I have a subselect which is used for decoding one field.
CURSOR snap_crs IS
SELECT decode (snap.id, 1,
(select code_ptr from anag_ptr where desc_ptr = snap.ptr_a),
(select code_ptr from anag_ptr where desc_ptr = snap.ptr_b)
),
..... other fields....
My question is: since * anag_ptr * is a static table (doesn't ever
change),
is it worthy to replace the subselect with values taken from a
Collection ?
Having a Java background I would use an Hashtable to insert couples
(code_ptr,desc_ptr)...but what about pl/sql ? can I do the same ?
Thanks a lot
Francesco |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Thu Jan 08, 2009 5:27 am | All times are GMT
|
|
Personal Finance | Personal Car Finance | Debt Consolidation | Secured Loans | MPAA
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|