Home » Developer & Programmer » Forms » Performance issue with WHERE clause (Forms 6i, Database 8i)
Performance issue with WHERE clause [message #524339] Fri, 23 September 2011 03:06 Go to next message
Derek N
Messages: 80
Registered: September 2002
Member
I have the following code with a sub query which takes 54.313 seconds to run in PL/SQL Developer:
SELECT *
  FROM transfers a
 WHERE a.location_code_from = 'ABC'
   AND a.season = 2011
   AND EXISTS (SELECT 'Y'
          FROM available_transactions b
         WHERE b.available_qty > 0
           AND a.season = b.season
           AND a.transfer_release_no = b.release_no);

When I change the code from a subquery to a standard join it takes .0234 seconds.
SELECT *
  FROM transfers a, available_transactions b
 WHERE a.location_code_from = 'ABC'
   AND a.season = 2011
   AND b.available_qty > 0
   AND a.fin_year = b.fin_year
   AND a.transfer_release_no = b.release_no;


My problem is that I have to use the code with the sub query as I need to use this code in the where clause of a block in forms. All indexes are fine. Are there any other options available?
Re: Performance issue with WHERE clause [message #524342 is a reply to message #524339] Fri, 23 September 2011 03:13 Go to previous messageGo to next message
Michel Cadot
Messages: 68675
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
For any peformances question, please read http://www.orafaq.com/forum/mv/msg/84315/433888/102589/#msg_433888 and post the required information.

Regards
Michel
Re: Performance issue with WHERE clause [message #524356 is a reply to message #524342] Fri, 23 September 2011 04:23 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Why can't you use the "subquery" code in your form?
Re: Performance issue with WHERE clause [message #524359 is a reply to message #524356] Fri, 23 September 2011 04:38 Go to previous messageGo to next message
Derek N
Messages: 80
Registered: September 2002
Member
The form takes a bit too long before the records are displayed when I use the subquery.
Re: Performance issue with WHERE clause [message #524360 is a reply to message #524359] Fri, 23 September 2011 04:43 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Ah, my bad, sorry - I mean to ask the opposite: why can't you use "standard join" query in your form?

How does the block WHERE clause look like? Is the asterisk the reason? If so, that's easy to handle - convert it into the column list.
Re: Performance issue with WHERE clause [message #524366 is a reply to message #524360] Fri, 23 September 2011 05:28 Go to previous messageGo to next message
Derek N
Messages: 80
Registered: September 2002
Member
Changed my query to :
SELECT *
   FROM transfers a
  WHERE a.location_code_from = 'ABC'
    AND a.season = 2011
    AND (a.season, a.transfer_release_no) IN
        (SELECT b.season, a.transfer_release_no
           FROM available_transactions b
          WHERE b.available_qty > 0)


It now works much faster. Now takes .828 seconds compared to 54.313 seconds. I used the asterisk as I was testing the performance via pl/sql developer. By the way can a standard join be used in the where clause of a form?
Re: Performance issue with WHERE clause [message #524370 is a reply to message #524366] Fri, 23 September 2011 05:48 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
If you mean something like
where id in (select a.id
             from table_a a, table_b b
             where a.id = b.id
               and a.label = 'X'
            )
then my answer would be "yes".

If not, what do you mean?
Previous Topic: Restriction on new record addtion in datablock through form menu plus icon
Next Topic: Problem runing Reports 11 from Forms 11
Goto Forum:
  


Current Time: Sat Sep 07 13:04:27 CDT 2024