Click here to Skip to main content
15,910,797 members
Home / Discussions / Database
   

Database

 
QuestionHow can i improve the performance of this query? Pin
tonyong11-Mar-08 4:24
tonyong11-Mar-08 4:24 
AnswerRe: How can i improve the performance of this query? Pin
Scott Dorman11-Mar-08 4:42
professionalScott Dorman11-Mar-08 4:42 
GeneralRe: How can i improve the performance of this query? Pin
tonyong11-Mar-08 4:59
tonyong11-Mar-08 4:59 
GeneralRe: How can i improve the performance of this query? Pin
Scott Dorman11-Mar-08 5:07
professionalScott Dorman11-Mar-08 5:07 
GeneralRe: How can i improve the performance of this query? Pin
tonyong11-Mar-08 5:28
tonyong11-Mar-08 5:28 
GeneralRe: How can i improve the performance of this query? Pin
Pete O'Hanlon11-Mar-08 12:23
mvePete O'Hanlon11-Mar-08 12:23 
GeneralRe: How can i improve the performance of this query? Pin
tonyong12-Mar-08 0:34
tonyong12-Mar-08 0:34 
GeneralRe: How can i improve the performance of this query? Pin
andyharman12-Mar-08 5:19
professionalandyharman12-Mar-08 5:19 
The following SQL would return all of the data from all 3 tables:
SELECT ppar_engparameters.parmval, ppar_engparameters.parmname,
    prcd.prcdname||' '||prcd.prcdversion, prcd.activeflag,
    prcd.prodstatis, catg_pll.catnumber, catg_pll.category
FROM ppar_engparameters
INNER JOIN prcd
  ON prcd.prcdname = ppar_engparameters.prcdname
  AND prcd.activeflag = 'A'
LEFT OUTER JOIN catg_pll
  ON catg_pll.partprcdname = prcd.prcdname
  AND catg_pll.partprcdversion  = prcd.prcdversion
WHERE ppar_engparameters.parmval= 'MyValue'
I have removed the "distinct" clause that you had in the original. This is often used to hide poorly-designed tables - you understand where-and-why you are getting duplicates before blindly using this.

Proper indexes are required to make this run fast. I would expect the following indexes (or primary keys) from your original description:
--For the link from product-parameter to product.
create unique index prcd_idx1 on prcd (prcdname, prcdversion)
--For the link from product.
create index catg_pll_idx1 on catg_pll (partprcdname, partprcdversion)
--For the search on parameter values.
create index ppar_engparameters_idx1 on ppar_engparameters
     (parmval, activeflag)
Other indexes may also be required for other activities. There should ideally be a primary key or unique-index on every table.

Oracle's query optimiser uses statistical data from indexes to determine the best way of answering your queries. There is a command (that I cannot remember) for recalculating these statistics.

Oracle is also able to display the query-plan that it uses - so you would be able to tell exactly what Oracle is doing under the covers. Search Google[^] for more information.

Hope that helps.

Regards
Andy
GeneralRe: How can i improve the performance of this query? Pin
tonyong12-Mar-08 14:22
tonyong12-Mar-08 14:22 
GeneralRe: How can i improve the performance of this query? Pin
tonyong13-Mar-08 2:28
tonyong13-Mar-08 2:28 
AnswerRe: How can i improve the performance of this query? Pin
Mark J. Miller11-Mar-08 7:35
Mark J. Miller11-Mar-08 7:35 
QuestionSQL Reporting Services - Anyone an expert? Pin
imnotso#11-Mar-08 3:50
imnotso#11-Mar-08 3:50 
AnswerRe: SQL Reporting Services - Anyone an expert? Pin
Mark J. Miller11-Mar-08 7:24
Mark J. Miller11-Mar-08 7:24 
GeneralRe: SQL Reporting Services - Anyone an expert? Pin
imnotso#11-Mar-08 23:51
imnotso#11-Mar-08 23:51 
GeneralRe: SQL Reporting Services - Anyone an expert? Pin
Mark Churchill12-Mar-08 0:36
Mark Churchill12-Mar-08 0:36 
GeneralRe: SQL Reporting Services - Anyone an expert? Pin
imnotso#12-Mar-08 1:21
imnotso#12-Mar-08 1:21 
GeneralRe: SQL Reporting Services - Anyone an expert? Pin
Mark Churchill12-Mar-08 2:18
Mark Churchill12-Mar-08 2:18 
GeneralRe: SQL Reporting Services - Anyone an expert? Pin
imnotso#12-Mar-08 2:33
imnotso#12-Mar-08 2:33 
GeneralSQL Connection TimeOut Pin
Johan Lombaard11-Mar-08 3:19
Johan Lombaard11-Mar-08 3:19 
GeneralRe: SQL Connection TimeOut Pin
Pete O'Hanlon11-Mar-08 12:21
mvePete O'Hanlon11-Mar-08 12:21 
GeneralRe: SQL Connection TimeOut Pin
#realJSOP14-Mar-08 8:15
professional#realJSOP14-Mar-08 8:15 
QuestionOracle upper Function Pin
Programm3r11-Mar-08 2:19
Programm3r11-Mar-08 2:19 
GeneralRe: Oracle upper Function Pin
witte2345611-Mar-08 2:45
witte2345611-Mar-08 2:45 
GeneralRe: Oracle upper Function Pin
Programm3r11-Mar-08 3:55
Programm3r11-Mar-08 3:55 
QuestionInstall with empty DB or create DB in code? Pin
petrveit11-Mar-08 0:50
petrveit11-Mar-08 0:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.