Subject | Re: [firebird-support] Query optimization |
---|---|
Author | Helen Borrie |
Post date | 2003-07-02T11:27:03Z |
At 01:04 PM 2/07/2003 +0200, you wrote:
Forgive all the snipping but first things first. :-))
You say there are no indices on subsidiary tables. Are there any keys?
What are you doing with a mega-grouped + ordered set in a FOR loop?
How many possible POSTYPEs are there?
How many possible POS_IDs?
What is the purpose of all those indices you have in the Log table?
Do you have any other indices on that table? (such as acc_num and sub_code?)
heLen
>Anyone got any ideas on how to optimize this query? It runs for three or[snip]
>four minutes, and there are only a few thousand records :
>
> FOR SELECT
> GROUP BY l.Receipt, l.Receipt2, l.Acc_Num, l.Sub_Code,Tim,
> l.inv_type, l.inv_prefix, c.SurName, s.Sub_Name, s.Card_Code,
> s.RegNum
> ORDER BY c.Surname, l.Acc_Num, l.Sub_Code
>
>
>The query plan :
>
>PLAN SORT (SORT (MERGE (SORT (S NATURAL),SORT (JOIN (C NATURAL,L INDEX
>(IDX_POSTYPE))))))
>
>And the indices : (No indices on subsidiary tables)
Forgive all the snipping but first things first. :-))
You say there are no indices on subsidiary tables. Are there any keys?
What are you doing with a mega-grouped + ordered set in a FOR loop?
How many possible POSTYPEs are there?
How many possible POS_IDs?
What is the purpose of all those indices you have in the Log table?
Do you have any other indices on that table? (such as acc_num and sub_code?)
heLen