List:General Discussion« Previous MessageNext Message »
From:Sasha Pachev Date:April 13 1999 5:03pm
Subject:Re: Performance.
View as plain text  
> Sasha,
> I don't see how I can rewrite it without LEFT JOIN. I tried to rewrite it as
> (which should be faster I think):
> SELECT Sum(JoinedLinkedInfo.ValueNum) AS Amount, LinkedInfo.Record_ID FROM
> JoinedLinkedInfo LEFT JOIN LinkedInfo USING (Link_ID) WHERE
> JoinedLinkedInfo.Field_ID=21 GROUP BY LinkedInfo.Record_ID;


I am afraid I don't have the time to sit down and think
through your query to figure things out, but in the time
I have I can offer a generic approach that will
hopefully help.

1) Decide what it is that you actually need from the
2) Think of a number of ways to accompilsh it, including
using intermediate results stored in a temporary table,
eliminate the ones that are obvously inefficient,   and
try each one of them on a smaller data set to make sure
that they work correctly.

3) Try it on a bigger data set to see which gives the
best performance 
4) Throught the entire process, try to think like the
database engine. If you see a more efficient way of
doing things than what the query optimizer decides on,
try re-writing the query, maybe breaking it down into
several and storing intermediate results, in such a way
that the optimizer will see how to do it best.

Sasha Pachev (home) (work)
Performance.Marc De Caluwé9 Apr
Re: Performance.Fred Lindberg9 Apr
  • RE: Performance.Marc De Caluwé13 Apr
    • Re: Performance.Sasha Pachev13 Apr
RE: Performance.Marc De Caluwé18 Apr
  • RE: Performance.Michael Widenius19 Apr