Subject | Re: Better procedure for "horizontal table"? |
---|---|
Author | Richard Saeger |
Post date | 2001-09-08T06:10:23Z |
--- In ib-support@y..., Svein Erling Tysvær
<svein.erling.tysvaer@k...> wrote:
Set,
You are _absolute_ on the right way.
I've changed the primary key from (Work_Day, Emp_No) to (Emp_No,
Work_Day) and the procedure run 25-times faster!
Thank you very much.
See you later :-).
Richard
<svein.erling.tysvaer@k...> wrote:
Set,
You are _absolute_ on the right way.
I've changed the primary key from (Work_Day, Emp_No) to (Emp_No,
Work_Day) and the procedure run 25-times faster!
Thank you very much.
See you later :-).
Richard
> One thing I suddenly realised: Your PK is (Work_Day, Emp_No). Thatmeans
> that IB has to look up every individual date (since you use BETWEENand is
> interested in more than one date) and then try to find theemployee. If
> your PK was the other way around (Emp_No, Work_Day), then IB couldjust
> locate the employee once find the first work_day and then traversedown the
> work_days (since they would be in sequence). I think that would beworth a
> try.
>
> HTH,
> Set