Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: SQL Power !!
22 eh? Did it ever run? Was Oracle forever trying to acquire a cache buffer chain latch. People or query generators needlessly joining views to their base tables is a big headache for us. Peoplesoft (in-the-head) loves to do this.
Ian MacGregor
Stanford Linear Accelerator Center
ian_at_SLAC.Stanford.edu
-----Original Message-----
Sent: Friday, May 09, 2003 10:27 AM
To: Multiple recipients of list ORACLE-L
Kirti,
I can challenge that !
I just finished optimising a query produced by developpement, once printed it was 6 pages long and accessed many tables.
But the best part is that a table was accessed 22 times. Yes 22 times (inline views madness).
After spending 1 hour trying to understand the beast without success, I just call the guy and ask what was the qestion the query was supposed to answer.
Stephane Paquette
Administrateur de bases de donnees
Database Administrator
Standard Life
www.standardlife.ca
Tel (514) 925-7187
stephane.paquette_at_standardlife.ca <mailto:stephane.paquette_at_standardlife.ca>
-----Original Message-----
Kirti
Sent: Friday, May 09, 2003 12:22 PM
To: Multiple recipients of list ORACLE-L
Here is what was caught by my co-worker recently.
One of the Developers, of our Preferred Vendor, actually wrote this stuff. This is invoked by the one of the forms on the intranet Web application. I was told there are quite a few scripts like this one. Performance issues? No one is complaining (yet) .... so who cares :) Enjoy...
- Kirti
SELECT DISTINCT CUST1.customer_id, LIST1.finding_name, NVL(LIST1.atn_npa, ' '), NVL(LIST1.atn_cop, ' '), NVL(LIST1.atn_line_no, ' '), LIST1.lni, NVL(LIST1.listed_tn_npa, ' '), NVL(LIST1. listed_tn_cop, ' '), NVL(LIST1.listed_tn_line_no, ' '), NVL(ADDR1.house_no, ' '), NVL(ADDR1.house_no_suff, ' '), NVL(ADDR1.pre_directional, ' '), NVL(ADDR1.street_name, ' '), NVL(ADDR1.post_directional, ' '), NVL(ADDR1.sub_location, ' '), NVL(ADDR1.Community, ' '), NVL(ADDR1.zip_five, ' '), NVL(ADDR1.state_abbr_override, ' '), LIST1.listing_status, NVL(CUST1.customer_type, ' '), NVL(CUST1.home_data_base, ' '), NVL(CUST1.default_market_code, ' '), NVL(TELCO.TELCO_CODE, ' '), NVL(TELCO.TELCO_NAME, ' '), NVL(TO_CHAR(LIST1.establish_date,'YYYYMMDD'),' '), NVL((select 'Y' from query q, dir_curr_issue where q.customer_id = cust1.customer_id and q.query_status in (1,3,4) and q.product_code = dir_curr_issue.directory_code and q.product_issue_num >= dir_curr_issue.directory_issue_num
and rownum = 1), 'N' ) ,
NVL(CUST1.TELCO_CREDIT_STOP, ' '), NVL(CUST1.BARS_CREDIT_STOP, 0), NVL(CUST1.EAST_CREDIT_STOP, ' '), NVL(CUST1.EARLY_CONT_CUST_IND, ' '), NVL(LIST1.SOHO_LST_IND, ' '), NVL(CUST1.NI_AMOUNT, 0), NVL(CUST1.PI_AMOUNT, 0), HEADING.short_heading_name, NVL(CUST1.CUST_PROSPECT_CODE, 0), NVL(CUST1.RETIREMENT_STATUS, ' '), (SELECT nvl(sum(DIRECTORY_SUMMARY0.pi_amount),0)
FROM
DIRECTORY_ISSUE e, DIRECTORY_SUMMARY DIRECTORY_SUMMARY0, ASSIGNMENT ASSIGNMENT_C, assignment ASSIGNMENT_T,DIR_CURR_ISSUE DIR_CURR_ISSUE0 WHERE DIRECTORY_SUMMARY0.customer_id = CUST1.customer_id and DIRECTORY_SUMMARY0.product_code = DIR_CURR_ISSUE0.directory_code and DIRECTORY_SUMMARY0.product_issue_num = DIR_CURR_ISSUE0.directory_issue_num
and DIRECTORY_SUMMARY0.PRODUCT_CODE = E.DIRECTORY_CODE
and DIRECTORY_SUMMARY0.PRODUCT_ISSUE_NUM = e.directory_issue_num and e.directory_del_ind != :1 and DIRECTORY_SUMMARY0.canvass_code = '' and DIRECTORY_SUMMARY0.T_SPLIT_ASSIGN_ID = ASSIGNMENT_T.assignment_id (+) and DIRECTORY_SUMMARY0.current_assign_id = ASSIGNMENT_C.assignment_id (+) AND :2 in (ASSIGNMENT_C.sales_rep,ASSIGNMENT_T.sales_rep))
,(CASE WHEN EXISTS( SELECT 1
FROM
DIR_CURR_ISSUE DC, DIRECTORY_SUMMARY DS
WHERE
CUST1.customer_id = DS.customer_id AND DS.product_code = DC.directory_code AND DS.PRODUCT_ISSUE_NUM >= DC.DIRECTORY_ISSUE_NUMAND DS.curr_special_flag = 20 and rownum = 1) THEN 'Y'
AND IC.PRODUCT = DIR1.product_code AND IC.issue_number = DIR1.product_issue_num AND IC.DELETE_INDICATOR ='N' )
CUST1.customer_id = DS.customer_id AND DS.product_code = DC.directory_code AND DS.PRODUCT_ISSUE_NUM >= DC.DIRECTORY_ISSUE_NUMAND DS.curr_special_flag = 20 and rownum = 1) THEN 'Y'
AND IC.PRODUCT = DIR1.product_code AND IC.issue_number = DIR1.product_issue_num AND IC.DELETE_INDICATOR ='N' )
-- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Deshpande, Kirti INET: kirti.deshpande_at_verizon.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Stephane Paquette INET: stephane.paquette_at_standardlife.ca Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: MacGregor, Ian A. INET: ian_at_SLAC.Stanford.EDU Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-LReceived on Fri May 09 2003 - 15:04:51 CDT
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).