Home » RDBMS Server » Performance Tuning » Optimizing Oracle SQL statements - can anyone help?
Optimizing Oracle SQL statements - can anyone help? [message #271037] Fri, 28 September 2007 14:55 Go to next message
jimicron
Messages: 1
Registered: September 2007
Junior Member
Hi all,

I am new to SQL but have really been trying to learn it lately and was wondering if there were more efficient ways to write these statements? I have been reading around and get a bit confused. Thanks for any help you can provide!!!

JIM

SQL Statement #1
SELECT
FUNCTIONAL_AREA, VERSION_DESCRIPTION, EXPENSE_ACCOUNT, COST_CENTER, EXPENSE, CALENDAR_MONTH_NAME
FROM
FIN_COMMON_DM.ACTUAL_EXPENSE_V
WHERE
VERSION_NAME='ACTUAL'
AND
FUNCTIONAL_AREA='R'
AND
(EXPENSE_ACCOUNT='561026'
OR
EXPENSE_ACCOUNT='539990'
OR
EXPENSE_ACCOUNT='541500'
OR
EXPENSE_ACCOUNT='541600')
AND
ORGANIZATION<>'IMFT'


SQL Statement #2
SELECT
FUNCTIONAL_AREA, VERSION_DESCRIPTION, EXPENSE_ACCOUNT_GROUP_L3, COST_CENTER, EXPENSE, CALENDAR_MONTH_NAME
FROM
FIN_COMMON_DM.ACTUAL_EXPENSE_V
WHERE
VERSION_NAME='ACTUAL'
AND
FUNCTIONAL_AREA='R'
AND
(EXPENSE_ACCOUNT_GROUP_L3='LABOR'
OR
EXPENSE_ACCOUNT_GROUP_L3='MATERIALS'
OR
EXPENSE_ACCOUNT_GROUP_L3='DEPRECIATION')
AND
ORGANIZATION<>'IMFT'

SQL Statement #3
SELECT
FUNCTIONAL_AREA, VERSION_DESCRIPTION, HEADCOUNT_GROUP_L1, COST_CENTER, HEADCOUNT, CALENDAR_MONTH_NAME
FROM
FIN_COMMON_DM.ACTUAL_HEADCOUNT_V
WHERE
FUNCTIONAL_AREA='R'
AND
VERSION_NAME='ACTUAL'
AND
HEADCOUNT_GROUP_L1='TOTAL SAP HEADCOUNT'
AND
ORGANIZATION<>'IMFT'

SQL Statement #4
SELECT
FUNCTIONAL_AREA, VERSION_DESCRIPTION, EXPENSE_ACCOUNT_GROUP_L2, COST_CENTER, EXPENSE, CALENDAR_MONTH_NAME
FROM
FIN_COMMON_DM.ACTUAL_EXPENSE_V
WHERE
VERSION_NAME='ACTUAL'
AND
FUNCTIONAL_AREA='R'
AND
EXPENSE_ACCOUNT_GROUP_L2='TOTAL EXPENSES'
AND
ORGANIZATION<>'IMFT'

SQL Statement #5
SELECT
FUNCTIONAL_AREA, VERSION_DESCRIPTION, EXPENSE_ACCOUNT_GROUP_L2, EXPENSE, CALENDAR_MONTH_NAME, ORGANIZATION
FROM
FIN_COMMON_DM.BUDGET_EXPENSE_V
WHERE
VERSION_NAME='BUDGET'
AND
EXPENSE_ACCOUNT_GROUP_L2='TOTAL EXPENSES'
AND
ORGANIZATION<>'IMFT'
AND
ORGANIZATION<>'IMFS'
Re: Optimizing Oracle SQL statements - can anyone help? [message #271041 is a reply to message #271037] Fri, 28 September 2007 15:01 Go to previous messageGo to next message
Michel Cadot
Messages: 68704
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Moved to Performance Tuning.

Please read and follow OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format. Use the "Preview Message" button.
Please always post your Oracle version (4 decimals).

Read How to Identify Performance Problem and Bottleneck.

Regards
Michel
Re: Optimizing Oracle SQL statements - can anyone help? [message #272207 is a reply to message #271041] Thu, 04 October 2007 04:18 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
I'm betting the _V suffix means these are all views.
Post the view definitions, and the Explain plans for the queries.
Previous Topic: database is going down very frequently
Next Topic: Performance Tuning
Goto Forum:
  


Current Time: Mon Nov 04 22:20:12 CST 2024