Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: SQL Power !!
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, ' '),
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' fromquery q, dir_curr_issue
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_numand 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),
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
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.main_main_listing_id = LIST1.listing_id(+) AND LIST1.last_version_ind(+) = :5 AND LIST1.listed_address_id = ADDR1.address_id(+) AND TELCO.TELCO_CODE = LIST1.TELCO_ID AND DIRECTORY_SUMMARY.customer_id = CUST1.customer_id ANDDIRECTORY_SUMMARY.PRODUCT_CODE = DIR_CURR_ISSUE.DIRECTORY_CODE AND DIRECTORY_SUMMARY.PRODUCT_ISSUE_NUM >= DIR_CURR_ISSUE.DIRECTORY_ISSUE_NUM AND
AND DS.PRODUCT_CODE = DC.DIRECTORY_CODE AND DS.PRODUCT_ISSUE_NUM >= DC.DIRECTORY_ISSUE_NUM AND DS.T_SPLIT_ASSIGN_ID = ASSIGNMENT_T.assignment_id (+) AND DS.current_assign_id = ASSIGNMENT_C.assignment_id (+)AND :7 in (ASSIGNMENT_C.sales_rep,ASSIGNMENT_T.sales_rep) AND DS.RETIREMENT_STATUS!= :8 ) AND
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, ' '),
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' fromquery q, dir_curr_issue
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_numand 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),
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 :14 in (ASSIGNMENT_C.sales_rep,ASSIGNMENT_T.sales_rep)) ,(CASE WHEN EXISTS( SELECT 1
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.main_main_listing_id = LIST1.listing_id(+) AND LIST1.last_version_ind(+) = :17 AND LIST1.listed_address_id = ADDR1.address_id(+) AND TELCO.TELCO_CODE = LIST1.TELCO_ID AND DIRECTORY_SUMMARY.customer_id = CUST1.customer_id ANDDIRECTORY_SUMMARY.PRODUCT_CODE = DIR_CURR_ISSUE.DIRECTORY_CODE AND DIRECTORY_SUMMARY.PRODUCT_ISSUE_NUM >= DIR_CURR_ISSUE.DIRECTORY_ISSUE_NUM AND
AND DS.PRODUCT_CODE = DC.DIRECTORY_CODE AND DS.PRODUCT_ISSUE_NUM >= DC.DIRECTORY_ISSUE_NUM AND DS.T_SPLIT_ASSIGN_ID = ASSIGNMENT_T.assignment_id (+) AND DS.current_assign_id = ASSIGNMENT_C.assignment_id (+)AND :19 in (ASSIGNMENT_C.sales_rep,ASSIGNMENT_T.sales_rep) AND DS.RETIREMENT_STATUS!= :20 ) AND
-- 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-LReceived on Fri May 09 2003 - 12:27:15 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). -- 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).